Linked Word Document resizing

J

jmezger

Hello,

I am currently linking multiple word documents into a visio file (I use the
copy-paste special method to link them). When I make an update to any of the
word documents, the size of the "shape" in visio grows much larger. To fix
the issue, I have to open each indivisual linked word document, which returns
it to the original size. The current document I am working on has
approximately 150 word documents linked in so this can be very frustrating
and time consuming.

I would like to either resolve the issue or create a macro which will
automatically go through the document and open each linked word document.
Any ideas?

Thanks!
 
P

Paul Herber

Hello,

I am currently linking multiple word documents into a visio file (I use the
copy-paste special method to link them). When I make an update to any of the
word documents, the size of the "shape" in visio grows much larger. To fix
the issue, I have to open each indivisual linked word document, which returns
it to the original size. The current document I am working on has
approximately 150 word documents linked in so this can be very frustrating
and time consuming.

I would like to either resolve the issue or create a macro which will
automatically go through the document and open each linked word document.
Any ideas?

This is a group for Visio, not Word.
I wish whoever maintains the community forums website would arrange
that after selecting Word, Excel, Visio or whatver that only the
groups for that product were still visible. What is the point of
selecting Word and still having all the groups visible?
 
J

jmezger

I apologize for the confusion, but the problem I am experiencing is in
regards to linked files within visio. This would mean that it is a visio
problem, not a word problem. Basically, I want to create a macro which will
traverse through a visio document and open and close all the linked files
(which happen to be word files). Any ideas how to do this?
 
P

Paul Herber

I apologize for the confusion, but the problem I am experiencing is in
regards to linked files within visio. This would mean that it is a visio
problem, not a word problem. Basically, I want to create a macro which will
traverse through a visio document and open and close all the linked files
(which happen to be word files). Any ideas how to do this?

My sincerest apologies! Am I embarrassed?

For each page in your document loop through the page.OLEObjects
There are page.OLEObjects.count of them and each one can be run with
OLEObject[n].Invoke
 
J

jmezger

Thanks for the quick response Paul. I will give it a try and let you know if
I run into to problems.

Jen

Paul Herber said:
I apologize for the confusion, but the problem I am experiencing is in
regards to linked files within visio. This would mean that it is a visio
problem, not a word problem. Basically, I want to create a macro which will
traverse through a visio document and open and close all the linked files
(which happen to be word files). Any ideas how to do this?

My sincerest apologies! Am I embarrassed?

For each page in your document loop through the page.OLEObjects
There are page.OLEObjects.count of them and each one can be run with
OLEObject[n].Invoke
 
J

jmezger

So I spent sometime today writing the following code:

Public Sub Resize_Word_Docs()

' Variable declaration
Dim vsoPage As Visio.Page
Dim vsoPages As Visio.Pages

Dim intStartIndex As Integer
Dim intPage As Integer
Dim intNumOfShapes As Integer

' Variable initialization
Set vsoPages = ActiveDocument.Pages
intStartIndex = 1

' loop through all the pages you have
For intPage = intStartIndex To ActiveDocument.Pages.Count

Set vsoPage = ActiveDocument.Pages(intPage)

' do not index background pages
If vsoPage.Background Then Exit For

For intNumOfShapes = 0 To vsoPage.OLEObjects.Count

vsoPage.OLEObjects(1).Invoke

Next intNumOfShapes

Next intPage

End Sub

I cannot get it to compile and I keep getting an error which says: Function
or interface marked as restricted, or the function uses an Automation type
not supported in Visual Basic.

Also, I am wondering if there is a way, once the files are opened, that they
can be closed again.

Any help would be greatly appreciated!


jmezger said:
Thanks for the quick response Paul. I will give it a try and let you know if
I run into to problems.

Jen

Paul Herber said:
I apologize for the confusion, but the problem I am experiencing is in
regards to linked files within visio. This would mean that it is a visio
problem, not a word problem. Basically, I want to create a macro which will
traverse through a visio document and open and close all the linked files
(which happen to be word files). Any ideas how to do this?

My sincerest apologies! Am I embarrassed?

For each page in your document loop through the page.OLEObjects
There are page.OLEObjects.count of them and each one can be run with
OLEObject[n].Invoke
 
P

Paul Herber

So I spent sometime today writing the following code:

Public Sub Resize_Word_Docs()

' Variable declaration
Dim vsoPage As Visio.Page
Dim vsoPages As Visio.Pages

Dim intStartIndex As Integer
Dim intPage As Integer
Dim intNumOfShapes As Integer

' Variable initialization
Set vsoPages = ActiveDocument.Pages
intStartIndex = 1

' loop through all the pages you have
For intPage = intStartIndex To ActiveDocument.Pages.Count

Set vsoPage = ActiveDocument.Pages(intPage)

' do not index background pages
If vsoPage.Background Then Exit For

For intNumOfShapes = 0 To vsoPage.OLEObjects.Count

vsoPage.OLEObjects(1).Invoke

Next intNumOfShapes

Next intPage

End Sub

A very important correction:

For intNumOfShapes = 0 To vsoPage.OLEObjects.Count-1

vsoPage.OLEObjects(intNumOfShapes).Invoke

Next intNumOfShapes
 
P

Paul Herber

So I spent sometime today writing the following code:

Public Sub Resize_Word_Docs()

' Variable declaration
Dim vsoPage As Visio.Page
Dim vsoPages As Visio.Pages

Dim intStartIndex As Integer
Dim intPage As Integer
Dim intNumOfShapes As Integer

' Variable initialization
Set vsoPages = ActiveDocument.Pages
intStartIndex = 1

' loop through all the pages you have
For intPage = intStartIndex To ActiveDocument.Pages.Count

Set vsoPage = ActiveDocument.Pages(intPage)

' do not index background pages
If vsoPage.Background Then Exit For

For intNumOfShapes = 0 To vsoPage.OLEObjects.Count

vsoPage.OLEObjects(1).Invoke

Next intNumOfShapes

Next intPage

End Sub

Let's try that again:
A very important correction:

For intNumOfShapes = 1 To vsoPage.OLEObjects.Count

vsoPage.OLEObjects(intNumOfShapes).Invoke

Next intNumOfShapes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top