Vebra Posted October 2, 2009 Posted October 2, 2009 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
Juvigy Posted October 2, 2009 Posted October 2, 2009 Try this one _ExcelBookSaveAs($oExcel, @ScriptDir & "\Medical", "xls", 0, 0, "password", "password")
Vebra Posted October 2, 2009 Author Posted October 2, 2009 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.
Juvigy Posted October 2, 2009 Posted October 2, 2009 _ExcelBookSaveAs($oExcel,"c:\Medical", "xls", 0, 0, "password", "password") ?
Vebra Posted October 2, 2009 Author Posted October 2, 2009 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.
Vebra Posted October 2, 2009 Author Posted October 2, 2009 Anyone have any thing else? I find it odd that it only does this when running the program from a flash drive.
Juvigy Posted October 13, 2009 Posted October 13, 2009 Try this one : $oExcel.Application.DisplayAlerts = False $oExcel.Application.ActiveWorkBook.SaveAs(@ScriptDir & "\Medical.xlsx",51,"","",False,False) $oExcel.Application.DisplayAlerts = True
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now