Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using this code to open a file dialog:
Public Sub OpenDialog1() Dim fileName As String 'Using the SendCommand method, send getfiled AutoLISP expressions to the AutoCAD command line. 'Set the return value to a user-defined system variable USERS1. ThisDrawing.SendCommand "(setvar " & """users1""" & "(getfiled " & """Select a DWG File""" & """c:/program files/acad2012/""" & """dwg""" & "8)) " 'Use the GetVariable method to retrieve this system variable to store the selected file name fileName = ThisDrawing.GetVariable("users1") MsgBox "You have selected " & fileName & "!!!", , "File Message" End Sub
If I click cancel, I get an error message:
Run-time error '-2145320859 (80210065)':
Error getting system variable
How can I trap this? Are there any functions specifically designed for this?
Secondly, when the sub has finished, I'd ideally like to clean out any variables. Is there a delvar or similar to get rid of these temporary variables when I don't need them?
Thanks
Solved! Go to Solution.