Author Topic: VBA to Open Drawing in Read Only  (Read 3338 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
VBA to Open Drawing in Read Only
« on: April 29, 2014, 01:21:52 PM »
How can I modify the following code to have the file always open up in Read Only oppose to write mode. The file I have is a master template that will keep getting updated.

Code: [Select]
Public Graphics As AcadApplication
 
Public Sub Loadtemplate(control As IRibbonControl)
   
    Dim strDrawing As String

    On Error Resume Next
    Set Graphics = GetObject(, "AutoCAD.Application")

    If Err.Description > vbNullString Then
        Err.Clear
        Set Graphics = CreateObject("AutoCAD.Application")
    End If

    strDrawing = "c:\temp\master.dwg"
    Graphics.Documents.Open (strDrawing)
   
    On Error GoTo 0

End Sub

Thanks for the help!!!!
Civil3D 2020

ssaqibh

  • Guest
Re: VBA to Open Drawing in Read Only
« Reply #1 on: April 30, 2014, 01:01:41 AM »
Try

 Graphics.Documents.Open strDrawing, true

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: VBA to Open Drawing in Read Only
« Reply #2 on: April 30, 2014, 07:09:25 AM »
Works! Thank you.
Civil3D 2020