C
Charlie
I have an unusual macro that I'm trying to get running. I put it in
Word VBA since I've used that a bit. What I'm trying to do is to
automate the process of opening a Works spreadsheet and from Works
saving it as an Excel file. This procedure works fine when the
commands are typed.... and according to the manual I have, they
"should" work when executed using the SendKeys commands from a VBA
macro. Here's the macro:
Sub Works_to_Excel()
Dim appWorks As Variant
Dim filename As String
filename = "caddo.wks"
'
' Open Works Spreadsheet & activate
'
appWorks = Shell("c:\program files\microsoft works\Wksss.exe",
vbNormalFocus)
AppActivate "Microsoft Works Spreadsheet"
'
' Send Works command to load file into Works
'
SendKeys "%FO" & filename & "{Enter}", True
'
' Change filename and send command to save as an Excel file
'
filename = "caddo.xls"
AppActivate "Microsoft Works Spreadsheet"
SendKeys "%FA" & filename & "{Tab}" & "E" & "{Enter}", True
'
End Sub
Although the long lines wrap when seen above, they are OK in the VBA
editor....
The maro runs and opens Works, but fails to load the spreadsheet. If
I split the macro into several small macros, and execute them
sequentially, it will open the spreadsheet and save it as an Excel
file (sometimes). Is there some timing factor involved, where I need a
long delay after sending the Works command, before sending another?
Any help or suggestions would really be appreciated.
Word VBA since I've used that a bit. What I'm trying to do is to
automate the process of opening a Works spreadsheet and from Works
saving it as an Excel file. This procedure works fine when the
commands are typed.... and according to the manual I have, they
"should" work when executed using the SendKeys commands from a VBA
macro. Here's the macro:
Sub Works_to_Excel()
Dim appWorks As Variant
Dim filename As String
filename = "caddo.wks"
'
' Open Works Spreadsheet & activate
'
appWorks = Shell("c:\program files\microsoft works\Wksss.exe",
vbNormalFocus)
AppActivate "Microsoft Works Spreadsheet"
'
' Send Works command to load file into Works
'
SendKeys "%FO" & filename & "{Enter}", True
'
' Change filename and send command to save as an Excel file
'
filename = "caddo.xls"
AppActivate "Microsoft Works Spreadsheet"
SendKeys "%FA" & filename & "{Tab}" & "E" & "{Enter}", True
'
End Sub
Although the long lines wrap when seen above, they are OK in the VBA
editor....
The maro runs and opens Works, but fails to load the spreadsheet. If
I split the macro into several small macros, and execute them
sequentially, it will open the spreadsheet and save it as an Excel
file (sometimes). Is there some timing factor involved, where I need a
long delay after sending the Works command, before sending another?
Any help or suggestions would really be appreciated.