SendKeys does not work on {ENTER} first action
SendKeys does not work on {ENTER} first action
(OP)
Hi All...I created a simple VBA code to demonstrate the SendKeys command. However, when the very first camera name appears, the SendKeys {"ENTER"} command does not work. I have to manually press Enter key on the keyboard in order to have the loop to continue. SendKeys {"ENTER"} does work on 2nd camera display and after.
So, how could I make the first SendKeys {"ENTER"} command work?
-------------------------
Sub CAMERA()
'//// Display total number of cameras in active document
MsgBox CATIA.ActiveDocument.Cameras.Count
Dim oCamera3D As Camera3D
Dim CameraIdent
For CameraIdent = 1 To CATIA.ActiveDocument.Cameras.Count
Set oCamera3D = CATIA.ActiveDocument.Cameras.Item(CameraIdent)
MsgBox oCamera3D.Name '//// Display camera's name
CATIA.RefreshDisplay = True
SendKeys "{ENTER}"
Next
CATIA.StartCommand "Fit All In"
End Sub
---------------------
Your help is much appreciated.
So, how could I make the first SendKeys {"ENTER"} command work?
-------------------------
Sub CAMERA()
'//// Display total number of cameras in active document
MsgBox CATIA.ActiveDocument.Cameras.Count
Dim oCamera3D As Camera3D
Dim CameraIdent
For CameraIdent = 1 To CATIA.ActiveDocument.Cameras.Count
Set oCamera3D = CATIA.ActiveDocument.Cameras.Item(CameraIdent)
MsgBox oCamera3D.Name '//// Display camera's name
CATIA.RefreshDisplay = True
SendKeys "{ENTER}"
Next
CATIA.StartCommand "Fit All In"
End Sub
---------------------
Your help is much appreciated.





RE: SendKeys does not work on {ENTER} first action
I am looking for a solution on this problem...
indocti discant et ament meminisse periti
RE: SendKeys does not work on {ENTER} first action
After running the macro, it stops at "MsgBox oCamera3D.Name", then I have to manually press Enter key on the keyboard in order to have the loop to continue. SendKeys {"ENTER"} does work on 2nd camera display and after.
Any idea?
RE: SendKeys does not work on {ENTER} first action
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: SendKeys does not work on {ENTER} first action
"...Create your own message box form." You mean use MSgBox command to create a message?
Thanks for your help
RE: SendKeys does not work on {ENTER} first action
Regards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: SendKeys does not work on {ENTER} first action
Thanks
RE: SendKeys does not work on {ENTER} first action
get a VBA programming book at the library or buy one.
I might seem rude but trust me I say that for your own good.
indocti discant et ament meminisse periti
RE: SendKeys does not work on {ENTER} first action
indocti discant et ament meminisse periti