Jump to content

Recommended Posts

Posted

Hi,

can any body tell me why I cant save a file with these settings:

#include <Excel.au3>
#include <Date.au3>
#include <DateTimeConstants.au3>
Local $iBatch = String(@MDAY & @MON & @YEAR & @YDAY)

$sFilePath1 = @ScriptDir & "\Test1.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)

If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Shame on you!")
    Exit
EndIf

_ExcelBookSaveAs($oExcel, @DesktopDir & $iBatch, "xls")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iBatch = ' & $iBatch & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
If Not @error Then MsgBox(0, "Success", "File was Saved!", 3)
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes

The script announces success w/out error...but no file is saved.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...