AutoCAD 2025 opens in background when loading a DWG with VBA

AutoCAD 2025 opens in background when loading a DWG with VBA

martin.cappe
Advocate Advocate
485 Views
2 Replies
Message 1 of 3

AutoCAD 2025 opens in background when loading a DWG with VBA

martin.cappe
Advocate
Advocate

Hello everyone,

 

I've recently upgraded to AutoCAD 2025, and I’ve noticed a change in how it behaves when opening DWG files through VBA. In previous versions, if AutoCAD was closed and I used VBA to open a DWG, AutoCAD would launch and display the file on-screen. However, with AutoCAD 2025, the application opens but remains invisible (running in the background) until I manually bring it to the foreground or add code to set the visibility to true

 

This behavior affects the user experience, especially when running scripts that need to display the file for review or further interaction. I was wondering, has anyone else experienced this change in AutoCAD 2025 ?

 

Thanks,

MC

0 Likes
486 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor

Show your code for how you open a dwg.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 3

almutaz_86
Advocate
Advocate

I think you should add some lines to your code

 

Dim acadapp As Object
    ' Try to get the AutoCAD application object
    On Error Resume Next
    Set acadapp = GetObject(, "AutoCAD.Application")
    On Error GoTo 0
    If acadapp Is Nothing Then
        ' AutoCAD is not open, so open it
        Set acadapp = CreateObject("AutoCAD.Application")
    Else
        ' AutoCAD is already open
        acadapp.Documents.Add
    End If
    With acadapp.Visible = True

 

 

maybe you missed last line

 

 

 

0 Likes