ronaldmacdonald
MIS
Hi
Im trying to save an impromptu report as excel with format from a macro. I am using the script layout suggested on the cognos support site:
Sub Main
Dim objimp As Object
Dim objrep As Object
Set objimp = CreateObject("Impromptu.Application"
objimp.OpenCatalog "C:\Test\aaa.cat"
Set ImpRep = ObjImp.OpenReport("C:\Test\aaa.imr"
objimp.Visible True
AppActivate "Impromptu - [aaa.imr]"
SendKeys "%F",1
SendKeys "A",1
SendKeys "{TAB}",1
SendKeys "{DOWN 8}",1
SendKeys "{ENTER}",1
SendKeys "+{TAB}",1
SendKeys "D:\test.xls",1
SendKeys "{ENTER}",1
Set objrep = Nothing
Set objimp = Nothing
End Sub
The problem lies with the sendkeys. The first sendkey to open the File menu seems to hang and nothing else happens. I can see the impromptu application on screen with the file tab looking like its been depressed but thats it! It just sits there. Interestingly when i run the script from the macro.mac file within cognosscript editor it works. When I run the macro.mcx file it hangs! Same code just one is compiled and the other is not.
Has anyone else experienced this? Is something stealing the focus? (No other active windows open though) or can I insert some delays between the statements?
Any help appreciated.
Ronald
Im trying to save an impromptu report as excel with format from a macro. I am using the script layout suggested on the cognos support site:
Sub Main
Dim objimp As Object
Dim objrep As Object
Set objimp = CreateObject("Impromptu.Application"
objimp.OpenCatalog "C:\Test\aaa.cat"
Set ImpRep = ObjImp.OpenReport("C:\Test\aaa.imr"
objimp.Visible True
AppActivate "Impromptu - [aaa.imr]"
SendKeys "%F",1
SendKeys "A",1
SendKeys "{TAB}",1
SendKeys "{DOWN 8}",1
SendKeys "{ENTER}",1
SendKeys "+{TAB}",1
SendKeys "D:\test.xls",1
SendKeys "{ENTER}",1
Set objrep = Nothing
Set objimp = Nothing
End Sub
The problem lies with the sendkeys. The first sendkey to open the File menu seems to hang and nothing else happens. I can see the impromptu application on screen with the file tab looking like its been depressed but thats it! It just sits there. Interestingly when i run the script from the macro.mac file within cognosscript editor it works. When I run the macro.mcx file it hangs! Same code just one is compiled and the other is not.
Has anyone else experienced this? Is something stealing the focus? (No other active windows open though) or can I insert some delays between the statements?
Any help appreciated.
Ronald