Jump to content

Hiding AutoCAD main window


pefi

Recommended Posts

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 by pefi
add info about excel
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Thanks! I'm dealing with blocks & attributes in the real life program, so I guess I might have to accept the reality.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...