Jump to content

Recommended Posts

Posted

I'm writing a script that takes user input, puts it in an excel file, and mails it off. I have it all working except when it gets run from a flash drive. Here is the offending line of code I believe:

_ExcelBookSaveAs($oExcel.Application, "Medical", "xls", 0, 0, "password", "password")

I did have it where it says Medical I did have the path and all that, it just did the same thing.

And here's my error:

C:\Program Files\AutoIt3\Include\Excel.au3 (348) : ==> The requested action with this object has failed.:
If $sPassword <> "" And $sWritePassword = "" Then $oExcel.ActiveWorkBook.SaveAs($sFilePath, $sType, $sPassword, Default, Default, Default, $iAccessMode, $iConflictResolution)
If $sPassword <> "" And $sWritePassword = "" Then $oExcel.ActiveWorkBook.SaveAs($sFilePath, $sType, $sPassword, Default, Default, Default, $iAccessMode, $iConflictResolution)^ ERROR
>Exit code: 1    Time: 19.529
Posted

That originally how it was. I did it again. It worked the first time around, and not again after that. That was the same deal with the way it is now. Works the first time I run the code, then I get the errors when I try to run it a second time for good measure.

Posted

Same deal. Works first time around. Run it a second time it poops out with that error. lol. This has been a thorn in my side for 2 weeks now.

Posted

Try this one :

$oExcel.Application.DisplayAlerts = False
$oExcel.Application.ActiveWorkBook.SaveAs(@ScriptDir & "\Medical.xlsx",51,"","",False,False)
$oExcel.Application.DisplayAlerts = True

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
  • Recently Browsing   0 members

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