TheSwamp

Code Red => VB(A) => Topic started by: MSTG007 on April 29, 2014, 01:21:52 PM

Title: VBA to Open Drawing in Read Only
Post by: MSTG007 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!!!!
Title: Re: VBA to Open Drawing in Read Only
Post by: ssaqibh on April 30, 2014, 01:01:41 AM
Try

 Graphics.Documents.Open strDrawing, true
Title: Re: VBA to Open Drawing in Read Only
Post by: MSTG007 on April 30, 2014, 07:09:25 AM
Works! Thank you.