Hi All,
We have an vba program written for us about 7 years ago. Up to now, we've had no problems with each Autocad update as the program has just worked for every version of Autocad. Having said that, we've recently updated to Autocad 2013 (64 bit) and the program stopped working at the first dialogue refernce:
CMDialog1.CancelError = True
We then added the following variable which has worked on one particular machine, but no others:
Dim CMDialog1 As New CommonDialog
On all machines, but one, the program stops at CMDialog1.CancelError = True and throws the followign error:
Run-time error 429. ActiveX component can't create object.
I have included the module below for context reference:
'----------------------------------------------------------------------
' Find a data file anme and path to process
'----------------------------------------------------------------------
Private Sub CommandButton5_Click()
ShowStatus "Select a File to Process"
' 1. Get and open the input data file
Dim CMDialog1 As New CommonDialog
CMDialog1.CancelError = True
On Error GoTo ErrHandler1
CMDialog1.DefaultExt = "RAW"
CMDialog1.InitDir = CurDir
CMDialog1.FileName = ""
CMDialog1.DialogTitle = "Select a Purlin/Girt Data File"
CMDialog1.Flags = cdlOFNOverwritePrompt + cdlOFNHideReadOnly
CMDialog1.Filter = "RAW File (*.raw)|*.raw|All Files (*.*)|*.*" ' Set filters
CMDialog1.FilterIndex = 1
CMDialog1.ShowOpen
FileName = CMDialog1.FileName ' file name plus path
DataPath = CMDialog1.InitDir ' path only
LogFileName = Left$(FileName, Len(FileName) - 4) + ".Log" ' log output file
ShowStatus "File " & FileName & " Selected"
Exit Sub
ErrHandler1:
ShowStatus "Error Reading File"
End Sub
The function is purely to enable the user to select a file. I should also mention (if it hasn't come through already) that I'm not proficient with VBA and don't really have any clues as to how to go about fixing this. As such, any feedback is welcome and appreciated...
Is there another way of selecting a file?
Thanks in advance,
John