Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

How do I create a button in a word template that will run a macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lobo - 31 Jan 2005 00:03 GMT
I Have four fields that need to be updated when the template is opened and I
have recorded a macro
Selection.WholeStory
   Selection.Fields.Update
   Selection.HomeKey

Now I want to display a button that the user can click to run this macro so
he can update the fields.

is it also possible to print the pages individualy to  individual pdf files
via a macro to be attached to an email later?

Thanks
Jezebel - 31 Jan 2005 01:12 GMT
Right-click any toolbar. Select customize. On the Commands tab select Macros
in the Categories list. Select your macro from the Commands list and drag it
to the toolbar yuou want.

Separately, that's a pretty lousy way to update the fields. You could just
use this line in place of what you currently have --

ActiveDocument.Fields.Update

But are you aware that your code (and this one-line equivalent) updates
fields only in the body of the document, not in headers, footers, textboxes,
etc? If you want to update all fields, wherever they are, use --

Dim pRange as Word.Range

For each pRange in ActiveDocument.StoryRanges
   Do
       pRange.Fields.Updatge
       Set pRange = pRange.Next
   Loop until pRange is nothing
Next

>I Have four fields that need to be updated when the template is opened and
>I
[quoted text clipped - 12 lines]
>
> Thanks
Lobo - 02 Feb 2005 22:01 GMT
Jezebel,

Thanks for the help, I'm just new to all this Macro writing, therefore my
bad macro.

I did not want the Button on the tool bar but in the document , so that it
is only available when that Template gets opened.

I have put in a command button object , that works

Now I need to be able to print each page seperately , and if possible with
the file name as one of the fields that was input previously

thanks

> Right-click any toolbar. Select customize. On the Commands tab select Macros
> in the Categories list. Select your macro from the Commands list and drag it
[quoted text clipped - 34 lines]
> >
> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.