Here's what I'm trying to accomplish. When a user selects a value of a combo box, an AutoCAD drawing pops up (the drawing is, of course, dependent on which value the user selects in the combo box). So here's what I've done:
1. I insert an unbound object onto the form from the Toolbox. This wizard pops up and I have to choose "Creat New" and specify that it will be an AutoCAD drawing. I name the unbound object OLE1.
2. I associate the following code with the combo box's After_Update event:
Private Sub cbo1_AfterUpdate()
If Me.cbo1 = "Value 1" Then
Me.OLE1.Class = "AutoCAD.Drawing.14"
Me.OLE1.OLETypeAllowed = acOLELinked
Me.OLE1.SourceDoc = "T:\DWG\BLOCKS\drawing1.dwg"
Me.OLE1.Action = acOLECreateLink
Me.OLE1.SizeMode = acOLESizeZoom
Else If Me.cbo1 = "Value 2" Then
etc, etc,
So anyway, the program gets stuck as soon as it hits the OLE1.Action = acOLECreateLink line. I get a run-time error (error 2637, I think) and it says it's unable to perform the action specified. Also none of the properties of OLE1 ever change. That is, the Source Doc is still blank and the OLE Type is still "Embedded."
So what can I do here? Any help would be more than appreciated.
1. I insert an unbound object onto the form from the Toolbox. This wizard pops up and I have to choose "Creat New" and specify that it will be an AutoCAD drawing. I name the unbound object OLE1.
2. I associate the following code with the combo box's After_Update event:
Private Sub cbo1_AfterUpdate()
If Me.cbo1 = "Value 1" Then
Me.OLE1.Class = "AutoCAD.Drawing.14"
Me.OLE1.OLETypeAllowed = acOLELinked
Me.OLE1.SourceDoc = "T:\DWG\BLOCKS\drawing1.dwg"
Me.OLE1.Action = acOLECreateLink
Me.OLE1.SizeMode = acOLESizeZoom
Else If Me.cbo1 = "Value 2" Then
etc, etc,
So anyway, the program gets stuck as soon as it hits the OLE1.Action = acOLECreateLink line. I get a run-time error (error 2637, I think) and it says it's unable to perform the action specified. Also none of the properties of OLE1 ever change. That is, the Source Doc is still blank and the OLE Type is still "Embedded."
So what can I do here? Any help would be more than appreciated.