I receive a read only spreadsheet daily that I am scripting to open, change tabs and then save as an ASCII text file. Everything is working fine except telling the spreadsheet I want it to open read only.
Below is an excerpt of my script and I have bolded where I try to press the hot key in the window that Excel opens to tell you the spreadsheet is read only. On the keyboard outside of scripting ALT-R or enter were perfectly but I can't get it to recognize in my script, the macro just hangs. The read only windows appears to be the active window.
Thanks for any tips
Bob
-------------------------------------
execute file>C:\Documents and Settings\v400678.US1\My Documents\Supply Point Scorecard\3 DOS\MMP Files\todaysfile.xls
WaitWindowOpen>Microsoft Excel - todaysfile.xls
setfocus>Microsoft Excel - todaysfile.xls
wait>3
press alt
wait>.2
send>R
wait>.2
release altwait>.2
press CTRL
wait>.2
press page up
wait>.2
release CTRL
wait>.2
press home
//save as ascii CSV file
Can't open a Read Only Spreadsheet
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Not sure what this had to do with a beta version so I have moved it to General.
When you debug the script how far does it get?
Have you tried:
Press ALT
Send>r
Release ALT
When you debug the script how far does it get?
Have you tried:
Press ALT
Send>r
Release ALT
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Curious.
Just tried pressing ALT+r manually in an open excel file and it does nothing. Is ALT+r a shortcut to an Excel macro you have written? What version of Excel are you using? I'm still on 2003.
the following line will open an excel file in readonly mode:
Run>C:\Program Files\Microsoft Office\OFFICE11\Excel.exe /r c:\File.xls
Just tried pressing ALT+r manually in an open excel file and it does nothing. Is ALT+r a shortcut to an Excel macro you have written? What version of Excel are you using? I'm still on 2003.
the following line will open an excel file in readonly mode:
Run>C:\Program Files\Microsoft Office\OFFICE11\Excel.exe /r c:\File.xls
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
JRL: If the spreadsheet is saved with a password needed to modify, then when it is opened you get a little popup with the choice to either enter the password or push a button to open it read only. Alt R is the equivalent of pushing the read only button.
Maybe he needs to set focus on the popup before sending the Alt R? (The main window name doesn't reflect the name of the file until it is open - at least if you open the file by clicking on it.)
Maybe he needs to set focus on the popup before sending the Alt R? (The main window name doesn't reflect the name of the file until it is open - at least if you open the file by clicking on it.)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Ah! So the problem is his script waits for the main Excel window to open and then immediately tries to send alt-r. Either it is sending the alt-r too soon - before the popup has appeared and therefore needs to wait for this popup; or, if the popup appears before the Excel window title contains the filename his WaitWindowOpen will wait forever.
OP: look at the flow of events - when does the popup appear. Does it appear after Excel's title contains the filename or before? What is its title?
OP: look at the flow of events - when does the popup appear. Does it appear after Excel's title contains the filename or before? What is its title?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?