Marco in MS Word

P

Petar Popara

How can I insert macro in several places in my Word document, and then just
once run macro and it will insert something in several locations in my
document?

I have already created macro, but I don't know how to say to a Word where
(several locations in my document) it should insert it when I run it from
menu.
 
C

Cindy M -WordMVP-

Hi Petar,
How can I insert macro in several places in my Word document, and then just
once run macro and it will insert something in several locations in my
document?

I have already created macro, but I don't know how to say to a Word where
(several locations in my document) it should insert it when I run it from
menu.
I'm not certain I understand exactly what you want. That you want to insert
the same informatin in several places? Or that you want to be able to call the
macro from different places? Or both?

As to inserting information into a word document: you need to choose a
"target". You can use bookmarks, or document variables in combinatin with
docVariable fields, or document properties, in combination with DocProperty
fields. The best choice really depends on exactly what you need; you don't
give us enough information to help guide you.

If you need to trigger the macro from "anywhere", then a toolbar would be the
best choice. An alternate, if you want to specifically click on something in
the document, would be a macrobutton field.

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 :)
 
H

Helmut Weber

Hi Peter,

in principle, You cannot insert the same macro several times into a doc.
You can insert several buttons, which point to the same macro.
But that probably isn't the question.

Have a look at bookmarks and ranges in online-help.

Using range, You can insert text at one or more a given positions,
like after the 30th character:

Dim oRng As Range
Set oRng = ActiveDocument.Range(30, 30)
oRng.Text = "__________"

and before the 11th paragraph,
and at the start of the 11th paragraph,
and 1000 characters after the end of the second table.
Everywhere You like,
as often as You like.

Greetings from Bavaria
Helmut Weber, MVP
"red.sys" & chr$(64) & "t-online.de"
Win XP, Office 2003
 

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