Sign in to follow this  
Followers 0
Vebra

Excel UDF Saveas Help

8 posts in this topic

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

Share this post


Link to post
Share on other sites



Try this one

_ExcelBookSaveAs($oExcel, @ScriptDir & "\Medical", "xls", 0, 0, "password", "password")

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

_ExcelBookSaveAs($oExcel,"c:\Medical", "xls", 0, 0, "password", "password")

?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Anyone have any thing else? I find it odd that it only does this when running the program from a flash drive.

Share this post


Link to post
Share on other sites

Anyone please? I beg of you.

Share this post


Link to post
Share on other sites

Try this one :

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

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