Sign in to follow this  
Followers 0
l3ill

Local or Global

3 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0