Hello All, I am trying to delay the macro from running for 2 seconds as per VBA code below. But it does not work and give me an error message at statement:
Application.Wait Now + TimeValue("00:00:02").
I also tried to use a MsgBox and SendKeys "{Enter}" trying to delay the program from runing , True, but it does not work either.
So, what is the right syntax or command to delay the macro for 2 more few seconds?
Remember, it is VBA code, not VB or CATScript. Please help me out.
Thank you
===================================
'Program purpose: To delay running the code 2 seconds before switching the cameras
Sub CAMERA()
Dim my3DViewer
Set my3DViewer = CATIA.ActiveWindow.ActiveViewer
MsgBox CATIA.ActiveDocument.Cameras.Count
CATIA.RefreshDisplay = True
MsgBox "Macro is running..."
' SendKeys "{Enter}", True '''' I tried this function, but it did not work well. So, I put it in comment text
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
Dim Application
Set Application = CATIA
Application.Wait Now + TimeValue("00:00:02") ' Error here: "method or property is not supported"
CATIA.StartCommand "Fit All In" ' Testing lines of code above
Next
End Sub
==========================================
Thank you in advance
Quin
Application.Wait Now + TimeValue("00:00:02").
I also tried to use a MsgBox and SendKeys "{Enter}" trying to delay the program from runing , True, but it does not work either.
So, what is the right syntax or command to delay the macro for 2 more few seconds?
Remember, it is VBA code, not VB or CATScript. Please help me out.
Thank you
===================================
'Program purpose: To delay running the code 2 seconds before switching the cameras
Sub CAMERA()
Dim my3DViewer
Set my3DViewer = CATIA.ActiveWindow.ActiveViewer
MsgBox CATIA.ActiveDocument.Cameras.Count
CATIA.RefreshDisplay = True
MsgBox "Macro is running..."
' SendKeys "{Enter}", True '''' I tried this function, but it did not work well. So, I put it in comment text
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
Dim Application
Set Application = CATIA
Application.Wait Now + TimeValue("00:00:02") ' Error here: "method or property is not supported"
CATIA.StartCommand "Fit All In" ' Testing lines of code above
Next
End Sub
==========================================
Thank you in advance
Quin