Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Visio document auto into Word document 1

Status
Not open for further replies.

SonicBoomBand

Technical User
Jun 4, 2004
42
GB
Hello you good people.

Just a quickie, I'm sure. I would like to import a visio document automatically into word on open of the word document. Have absolulately no idea where to begin with this one.

Can't seem to find any threads for this question.

Any help would be much appreciate.

Regards
SonicBoomBand

Andrew Chamberlain
National Grid Transco
 
You want a specific Visio document when you open a new word document?
 
No, I want to open an existing Word document.

Andrew Chamberlain
National Grid Transco
 
And you want any active Visio document to open in word or is it a set one?
 
It's a set one. Basically, the last page in my Word document wants to be the Visio document.

Andrew Chamberlain
National Grid Transco
 
Have you tried to play with the Word macro recorder ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yeah tried that. The problem I have is that I can't manually insert the Flow Diagram into Word. I think I need to open Visio, copy document and paste into Word. Easy enough if I did it manually each time.

Has anybody got any code that will open Visio and Copy a diagram.

Getting desperate now, the boss is pressuring me. I could be sacked if I don't get this sorted. Please help...

Andrew Chamberlain
National Grid Transco
 
Frankly, the macro recorder should let you record exactly what you want to do. However, your description of what you want to do is still a little unclear. So OK, here is what I understand.

1. You have a Word file, and a Visio file
Unclear = the word "set" is used
Unknown = does that means you will be inserting the same Visio file - or different ones? This is a rather important piece of information.

2. You want to insert the Visio file at the end of the Word doc, automatically inserted when the Word doc opens.
Unclear = insert all of the Visio file? One chart - could there be more than one chart?

3. At the end of the document.
Unclear = do you need a page break before the Visio chart?, a section break? Will there be other text (or whatever) after the Visio chart(s)?

Based on the assumption that you want the SAME Visio file.
Based on the assumption that you want the ENTIRE Visio file
Based on the assumption that you want a section break to hold the Visio file.

Here goes.

Code:
Selection.EndKey unit:=wdStory
        Selection.InsertBreak Type:=wdSectionBreakNextPage
    Selection.InlineShapes.AddOLEObject ClassType:="Visio.Drawing.6", _
    FileName:=[i]full path filename[/i], LinkToFile:=False, DisplayAsIcon:=False

If the assumptions are incorrect, please be as specific as possible in your reply. For example, a crucial piece of info would be if there is a specific diagram/chart in the Visio file you want to get. You did not say...so, shrug, I assume you want to get the whole thing.

Better user specs, better software.



Gerry
 
That is spot on Gerry. Your assumptions where correct and the code is ideal. I knew there must have been a way. I will endeavour to make my questions a bit more informative next time.

Much Appreciated


Andrew Chamberlain
National Grid Transco
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top