×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SendKeys does not work on {ENTER} first action

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.

RE: SendKeys does not work on {ENTER} first action

does it work if you start your script with a shortcut instead of any other way?

I am looking for a solution on this problem...

Eric N.
indocti discant et ament meminisse periti

RE: SendKeys does not work on {ENTER} first action

(OP)
what do you mean by " short-cut"?
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

(OP)
Sorry Ferdo.....

"...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

(OP)
Hi Ferdo.... I am not sure how to start and make an user form since I have never done it before. Could it be made in VB Editor? IF so, how do I start?

Thanks

RE: SendKeys does not work on {ENTER} first action

this forum is for CATIA knowledge sharing, it really seems you should also join a VBA forum and search VBA answers there.

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.

Eric N.
indocti discant et ament meminisse periti

RE: SendKeys does not work on {ENTER} first action

using Tools / customize you can assign a shortcut to your macro (many video on youtube about that)

Eric N.
indocti discant et ament meminisse periti

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources