Mongoose Posted March 2, 2010 Share Posted March 2, 2010 I have a spreadsheet which has been saved with the 'read-only recommended' option switched on. If I try to open the spreadsheet using the _ExcelBookOpen() function, a dialog box pops up which tells me that it is recommended to open the spreadsheet in read only mode unless I need to make any changes. The problem as I see it is that the script pauses until _ExcelBookOpen() completes which it can't do as the spreadsheet can't open until the dialog box is clicked. I can't intereact with the dialog box as the sript is paused until _ExcelBookOpen() completes. How can I click the dialog box if both parts of my script are waiting for the other to finish? Any help gratefully received. Link to comment Share on other sites More sharing options...
enaiman Posted March 2, 2010 Share Posted March 2, 2010 Open it in read-only mode. If you need to make changes ... well, it will get complicated. What's preventing you to get a "normal" file? Why can't you make your script to detect the new window and press the desired button? SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Mongoose Posted March 2, 2010 Author Share Posted March 2, 2010 If I could open it read only I would but I need to make some changes to the spreadsheet. Link to comment Share on other sites More sharing options...
enaiman Posted March 2, 2010 Share Posted March 2, 2010 As I said: - get a "normal" file instead of that one (either remove the read-only thing either create a new file and copy everything) OR - get the title of the pop-up and button handles and make your script push the button SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 2, 2010 Share Posted March 2, 2010 (edited) It would be better if we knew how to explicitly open in RW with a parameter that prevented that dialog from occurring, but I don't know how to do that.Since the call to $oExcel.WorkBooks.Open() is blocking, you would have to kick off a separate process to deal with that pop up dialog. One easy way to do that is for the script to Run() itself with a command line switch that causes that instance to only handle the pop up and then exit.P.S. Hmm... wasn't that hard to Google a solution after all. There is a parameter for the .Open() method called IgnoreReadOnlyRecommended. You could try something like: $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open($sFilePath, Default, False, Default, $sPassword, $sWritePassword, True)That seventh parameter = True is IgnoreReadOnlyRecommended. Edited March 2, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
enaiman Posted March 2, 2010 Share Posted March 2, 2010 (edited) Since the call to $oExcel.WorkBooks.Open() is blockingHat-off; I didn't think of that. You're right 100% - it looks like Mongoose doesn't have too much choice.There is a parameter for the .Open() method called IgnoreReadOnlyRecommendedThat's nice Edited March 2, 2010 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
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