Visio Guy

Visio Discussions => Programming & Code => Topic started by: ziko on May 13, 2010, 04:33:24 PM

Title: Embedding OLE object
Post by: ziko on May 13, 2010, 04:33:24 PM
When I use ole.DoVerb(vbOLEShow) Visio doesn't embed perfectly in the OLE,
how can I adjust it to have the same size as the OLE object?

Thank you,
Ziko
Title: Re: Embedding OLE object
Post by: JuneTheSecond on May 13, 2010, 11:50:12 PM
Did you checked Application.DoCmd visCmdEditOpenObject ?
Title: Re: Embedding OLE object
Post by: ziko on May 14, 2010, 09:58:09 PM
I will give it a try,
Does this command opens the embedded visio to the same size of the OLE?
Thank You,
Ziko
Title: Re: Embedding OLE object
Post by: ziko on May 17, 2010, 07:45:29 PM
The DoCmd vixCmdEditOpenObject didn't actually work, it returned an error that the requested operation is presently disabled.

I also have another problem when embedding visio in an OLE is that when I click on a button on my form visio closes, which is fine but it is running in the background. How can I make sure it completely shut down? Cause now I need to delete the task from the task manager.

Thank You,
Ziko
Title: Re: Embedding OLE object
Post by: JuneTheSecond on May 17, 2010, 11:27:15 PM
"The requested operation is presently disabled" pops up when the particular shape is not selected.
Title: Re: Embedding OLE object
Post by: ziko on May 18, 2010, 02:30:25 PM
I don't think you understand my question.
I am using VB to embed visio in an OLE using the code:ole.DoVerb(vbOLEShow)
Problems:
1- When visio opens in the OLE it didn't resize properly and get the same size as the OLE object.
2- After clicking on a button on the VB form visio get unloaded but it still running in the background, I have to create go kill the process manually from the task manager.
Maybe I didn't know how to use the DoCmd vixCmdEditOpenObject you suggested.
Thank you I really appreciate your help,
please keep the thoughts coming I really need to fix these two critical issues very soon
Title: Re: Embedding OLE object
Post by: ziko on May 19, 2010, 04:27:36 PM
Issue #2 is fixed. in the lostFocus event or when the form is closing we have to shut down the object contained in the OLE object:If ole.AppIsRunning Then
        Call ole.object.Close
    End If

Now I still need to fix the resize problem, when visio embeds into the OLE.
Title: Re: Embedding OLE object
Post by: ziko on June 07, 2010, 02:39:23 PM
The answer to have visio or any object embedded correct in an OLE object is to set this property:
OLE.SizeMode = vbOLESizeStretch
or vbOLESizeStretch
or vbOLESizeAutoSize ...