PDA

Click to See Complete Forum and Search --> : could not load some objects


jonesy29847
Oct 21st, 2005, 09:47 AM
I receive the following error when I try to load a VB application into AutoCAD 2005. RobDog888 posted an answer (315175), I think my problem is I don't understand where the As Object declaration goes, as shown below give me an error.


Private Sub btnPlotNow_Click() As Object

FilePath = Module1.GetScriptFileLocation
If SaveScripts Then
Open FilePath & "\Batchplt.scr" For Output As 1
For dwg = 0 To dlgBatchPlot.dlgDrawingFileList.ListCount - 1
WriteScript2005 (1)
Next dwg
Close 1
End If
dlgBatchPlot.Hide
End Sub

RobDog888
Oct 21st, 2005, 11:31 AM
Welcome to the Forums.

I havent done anything with automating AutoCad but I dont think that the button click signature is correct.
Private Sub btnPlotNow_Click() As Object
'Should be...
Private Sub btnPlotNow_Click()

jonesy29847
Oct 21st, 2005, 11:33 AM
Thanks for fast reply!

Where would I put As Object?

RobDog888
Oct 21st, 2005, 11:39 AM
Why do you need "Object"?

RobDog888
Oct 21st, 2005, 11:41 AM
I found the link your referring to and are you using VB6 to automate AutoCad?

jonesy29847
Oct 21st, 2005, 12:03 PM
Yes I am. I had the program written and functional and when I loaded it into another users system it functioned, then when I tried to use it the next day I would get the "Could not load some objects because they are not available on this machine" error message. When I acknowledge the errors and can to the VB editor I can see some buttons are gone. If I run the program I get an error indicating a run time error of, get this, -2147352573 and when I select Debug the code that shows the form is displayed, all the form buttons except two are gone, and even though I see the form on the project tree the option of removing it is not available.

jonesy29847
Oct 21st, 2005, 12:04 PM
PS the other user is running AutoCAD2004 and I am running 2005

RobDog888
Oct 21st, 2005, 12:13 PM
Ok, now I see whats this issue. Your program reference to AC is 2005 and the users version is 2004 so it can not load the newer button objects on that system. You need to use latebinding (declaring your AC object variables as an Object). Then you need to make sure you only use controls, objects, properties, function, and methods that are available and supported in both versions or all versions you want to support in your app.
Dim oApp As Autocad.Application ' Or how ever its done
'Should be...
Dim oApp As Object

jonesy29847
Oct 21st, 2005, 01:46 PM
You 'da man RobDog!

Interestingly enough I found that I would loose objects surrounded by frames. I recreated my Dialog Box without them. When I got your latest I mad your changes, and added a frame and volia!