Hello
I'm trying to control the 'flaky' sendkeys to print a number of documents in VBA by using the kernel32 dll and the 'sleep' method set to 1sec gaps between each object. This is all being done in a client site product that uses vba.
My code is
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub CommandButton9_Clicked(ByVal EventData As TKoCommandButton.ClickedEventDataBag)
Dim Obj As Object
Set Obj = FlexSheet1.Frames
For Each Obj In FlexSheet1.Frames
Sleep 1000
SendKeys "^+{F12}", True
SendKeys "{ENTER}", True
Sleep 1000
FlexSheet1.SelectNextFrame
Next Obj
End Sub
when this runs it does not print all the objects, but just the last one. Does anyone know of a way around this so it will print all objects, from all frames. I'm thinking that i need to slow down the sendkeys operation becuase it does not seem to be able to keep up with the process. But not sure how to do this?
If i take out the for each statment so that there is only one object in one frame it prints no sweat.
Any ideas. Thanks in advance.
I'm trying to control the 'flaky' sendkeys to print a number of documents in VBA by using the kernel32 dll and the 'sleep' method set to 1sec gaps between each object. This is all being done in a client site product that uses vba.
My code is
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub CommandButton9_Clicked(ByVal EventData As TKoCommandButton.ClickedEventDataBag)
Dim Obj As Object
Set Obj = FlexSheet1.Frames
For Each Obj In FlexSheet1.Frames
Sleep 1000
SendKeys "^+{F12}", True
SendKeys "{ENTER}", True
Sleep 1000
FlexSheet1.SelectNextFrame
Next Obj
End Sub
when this runs it does not print all the objects, but just the last one. Does anyone know of a way around this so it will print all objects, from all frames. I'm thinking that i need to slow down the sendkeys operation becuase it does not seem to be able to keep up with the process. But not sure how to do this?
If i take out the for each statment so that there is only one object in one frame it prints no sweat.
Any ideas. Thanks in advance.