I have this vba code that I use to use with AutoCAD 2015. It was able to activate a command in autocad that would bring up a dialog box. Then it would proceed with the sendkeys on that dialog box.
I am trying the same thing in 2018 and the sendkeys do not work on the dialog box. However, when I close the dialog box, it runs the sendkeys at the command line. Not quite sure whats going on.
Thank you for any help!
Sub Catchment()
On Error Resume Next
Set AcadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
Set AcadApp = CreateObject("AutoCAD.Application")
End If
AppActivate AcadApp.Caption
AcadApp.Visible = True
AcadApp.Application.WindowState = acNorm
AcadApp.ActiveSpace = acModelSpace
If AcadApp.Documents.Count = 0 Then
AcadApp.Documents.Add
End If
AcadApp.ActiveDocument.SendCommand "_CREATECATCHMENTFROMOBJECT" & vbCr
End Sub
Sub Catchment_Storm_SendKeys()
Dim myApp As String
DoEvents
Application.Wait (Now + TimeValue("0:00:01"))
Sleep 250
SendKeys "{TAB}{TAB}{TAB}{TAB}", True
Sleep 250
SendKeys "{ENTER}", True
Sleep 250
SendKeys "{TAB}{TAB}{TAB}{TAB}", True
End Sub