Cheyenne2018
Computer
- Apr 11, 2018
- 4
Hi,
I need to open a dwg file, run a script (.scr) and close Draftsight. I'm started with open the document.I found this code from jrice174 and I've tried to edit for Draftsight:
Return me a error: method or data member not found to
If I comment the line
Draftsight start but without opening the test.dwg
Thanks for the help..
I need to open a dwg file, run a script (.scr) and close Draftsight. I'm started with open the document.I found this code from jrice174 and I've tried to edit for Draftsight:
Code:
Sub openDraftsight()
Dim dsApp As Object
Dim NewFile As Object
Dim dsAppPath As String
Dim bReadOnly As Boolean
On Error Resume Next
Set dsApp = GetObject(, "DraftSight.Application")
If (Err <> 0) Then
Err.Clear
Set dsApp = CreateObject("DraftSight.Application")
If (Err <> 0) Then
MsgBox "Could Not Load DraftSight!", vbExclamation
End
End If
End If
'If you want to see AutoCAD on screen
dsApp.Visible = True
MydsAppPath = "C:\test.dwg"
bReadOnly = True
'Set NewFile = Draftsight.Documents.Open(MydsAppPath, bReadOnly)
If (NewFile Is Nothing) Then
ErrorMessage:
If NewFile = "False" Then End
MsgBox "Could not find the required spreadsheet that should be located at" & vbCr & MydsAppPath & vbCr & "Please rename or relocate the specified file as needed."
End
End If
'Close Draftsight Process
'dsApp.Quit
Set dsApp = Nothing
Set NewFile = Nothing
End Sub
Return me a error: method or data member not found to
Code:
Documents
If I comment the line
Code:
Set NewFile = Draftsight.Documents.Open(MydsAppPath, bReadOnly)
Thanks for the help..