Visio VSTO Insert Word Object

Started by Foxfire180, March 26, 2021, 02:45:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Foxfire180

I am unable to find a good solution for imbedding a Word file into the active sheet on Visio. We have a set of master notes (In word) we want to embed on the active sheet (with its own name) similar to the application function Insert > Object > Create from File. I have found solutions for excel and word but none for Visio.

I have tried using the clipboard method and got it to work, but its buggy and doesn't always work correctly. I want to say there is a better solution. I did find an INSERTFROMFILE and the *.Drop option, but they only seems to work with other Visio resources.

Any help would be appreciated. I am using VB.

thanks,

Foxfire180

I want to say that after additional looking into this further, I am unable to find anything that seems to suggest that i can do this within the application so maybe some help with my clipboard solution. The following is my Clipboard code:

   
Public Sub MasterNotes()

        Dim fdNotes() As String = {"\\File Location\FUNCTIONAL DIAGRAM NOTES.docx"}
        Dim d As New System.Windows.Forms.DataObject(System.Windows.Forms.DataFormats.FileDrop, fdNotes)

        System.Windows.Forms.Clipboard.SetDataObject(d, False)

        Globals.ThisAddIn.Application.ActivePage.PasteToLocation(3.75, 3.5, 0)

        System.Windows.Forms.Clipboard.Clear()

    End Sub


This works the first time i open Visio and only on the first sheet. It then is hit or miss if it works again after than. I sometimes have to restart Visio and then it may/may not work afterword's. I can confirm that i even cleared the clipboard prior to running the code and the same thing happens.