Can you place variables in a Word document? 
Author Message
 Can you place variables in a Word document?

I'm making my own DayTimer.  I have a single document (four 2-sided
compact pages per 8.5x11) containing all the days of August 2000.  I
would like to be able to run a macro where I could enter a month name
(September, October, etc) and year (2000, 2001, etc), and where I could
specify the first weekday name (Monday, Tuesday, etc) and month day
number (1, 2, 3, etc.), and the macro would automatically adjust all the

pages appropriately.  [I'm doing the 2-page per day format, so require
an unstraightforward ordering to make the pages turn out right.]  I
already know how to program macros, but I lack one key to complete this
task.  It would be nice if I could place variables thoughout the
document.  I would have one variable for the month, one for year, and 31

each for month day names and numbers.   Within the macro I would assign
the correct values to all variables and have them print correctly in the

document.  Does Word have this variable concept?  (I've considered
bookmarks and fields but have not been able to make them work in a clean

straightforward way.  For example, using bookmarks I could invoke
SELECTION.GOTO, then SELECTION.TEXT=, but that would erase the
bookmark.  Also, I've not found a way to make a field work)  Any ideas?



Sat, 25 Jan 2003 03:00:00 GMT  
 Can you place variables in a Word document?

Hi Larry,

What you need to do is recreate the bookmark after you have added the text.
There is code for this at the new Word MVPs FAQ page at www.mvps.org/word/

Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
Word FAQs at http://www.multilinker.com/wordfaq
Please post any follow-up in the newsgroup. I do not reply to Word questions
by email

Quote:

>I'm making my own DayTimer.  I have a single document (four 2-sided
>compact pages per 8.5x11) containing all the days of August 2000.  I
>would like to be able to run a macro where I could enter a month name
>(September, October, etc) and year (2000, 2001, etc), and where I could
>specify the first weekday name (Monday, Tuesday, etc) and month day
>number (1, 2, 3, etc.), and the macro would automatically adjust all the

>pages appropriately.  [I'm doing the 2-page per day format, so require
>an unstraightforward ordering to make the pages turn out right.]  I
>already know how to program macros, but I lack one key to complete this
>task.  It would be nice if I could place variables thoughout the
>document.  I would have one variable for the month, one for year, and 31

>each for month day names and numbers.   Within the macro I would assign
>the correct values to all variables and have them print correctly in the

>document.  Does Word have this variable concept?  (I've considered
>bookmarks and fields but have not been able to make them work in a clean

>straightforward way.  For example, using bookmarks I could invoke
>SELECTION.GOTO, then SELECTION.TEXT=, but that would erase the
>bookmark.  Also, I've not found a way to make a field work)  Any ideas?



Sat, 25 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How do I place a value of variable within a document

2. Replacing words/variables in a word document

3. Autonumber in an Access Database to be placed in Word document

4. acessing textboxes placed on a word document

5. Place text at Footer of Word Document

6. how to gather html from several documents and place into one big document

7. Cutting a full Word document and pasting it in another Word Document

8. Placing contants of VB variable in JavaScript Variable

9. Variables on a word document?

10. put last word of document into variable

11. Insert data from VBA variable into Word Document??

12. VB Variables Into Word Documents

 

 
Powered by phpBB® Forum Software