pefi Posted July 19, 2016 Share Posted July 19, 2016 (edited) Is there a way of keeping the main autocad window hidden? I run vba code and I'd like to keep the main window hidden. I tried to use ACAD.Application.Visible = False and it works, but as soo as I call something like ACAD_DWG.SendCommand "-insert" & vbCr & ACAD_BLOCK & vbCr & "0" & "," & "0" & vbCr & vbCr & vbCr & vbCr the main window pops to the front. I run the vba code controlling AutoCAD from excel. Edited July 19, 2016 by pefi add info about excel Quote Link to comment Share on other sites More sharing options...
pefi Posted July 19, 2016 Author Share Posted July 19, 2016 Test code that I run from excel VBA: Public Sub test() Dim ACAD As AcadApplication Dim ACAD_DWG As AcadDocument Set ACAD = New AcadApplication 'window invisible Set ACAD_DWG = ACAD.Documents.Add 'autocad icon appears the task bar ACAD_DWG.SendCommand "line" & vbCr & "0,0" & vbCr & "10,10" & vbCr & vbCr 'main autocad window goes to the front On Error Resume Next ACAD.Quit Set ACAD = Nothing End Sub Quote Link to comment Share on other sites More sharing options...
Hippe013 Posted July 21, 2016 Share Posted July 21, 2016 I believe, and this is just a guess here, that the reason is because you are using SendCommand. SendCommand is putting the focus onto AutoCAD. I believe that if you added your line or insert straight to the database without using SendCommand that you could keep the Application Window hidden. Quote Link to comment Share on other sites More sharing options...
pefi Posted July 21, 2016 Author Share Posted July 21, 2016 Thanks! I'm dealing with blocks & attributes in the real life program, so I guess I might have to accept the reality. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.