Jump to content

Local or Global


 Share

Recommended Posts

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.

Link to comment
Share on other sites

Dont know how exel works but try this

_ExcelBookSaveAs($oExcel, @DesktopDir & "\" & $iBatch, & ".xls")

or

_ExcelBookSaveAs($oExcel, @DesktopDir & "\" & $iBatch, ".xls")

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...