Word Automation with VBScript

B

BernardG

I am using VBScript for a very simple Word automation task, which consists in opening a HTML file and saving it as a Word document. In order to generate a standalone document, I need to break the links of all InlineShapes, so that they are saved along with the document. From Word, I do this using menu "Edit->Links", selecting all files, and using the "Break Link" button, which is very fast. From VBScript, I tried looping through the InlineShapes and using LinkFormat.BreakLink, which works, but it takes ages when the document has plenty of links. Does anyone know how I can perform the same task as when using "BreakLink" button from the "Edit->Links" dialog box, from VBScript?
Thanks.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?QmVybmFyZEc=?=,
I am using VBScript for a very simple Word automation task, which consists in opening a
HTML file and saving it as a Word document. In order to generate a standalone document, I
need to break the links of all InlineShapes, so that they are saved along with the document.
From Word, I do this using menu "Edit->Links", selecting all files, and using the "Break
Link" button, which is very fast. From VBScript, I tried looping through the InlineShapes
and using LinkFormat.BreakLink, which works, but it takes ages when the document has plenty
of links. Does anyone know how I can perform the same task as when using "BreakLink" button
from the "Edit->Links" dialog box, from VBScript?No, but since these are INLINEshapes, you might try simply unlinking the field that's
maintaining the link. that would probably be faster.

doc.InlineShapes(counter).Range.Fields(1).Unlink

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 

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