VBA and Fields in Word and Excel 97/2000 
Author Message
 VBA and Fields in Word and Excel 97/2000

Good morning everybody.
I'm new to VBA.
I'd like to write a macro for Word and or Excel 97/2000, which allows me
to insert fields in a document/sheet.
I regularly use the "File - Properties" of a Word or Excel document/sheet
and fill the fields "Title", "Subject" and "Company" under the summary
tab. I also create a "Client", a "Date" and a "Suivi" field under the
custom tab.
So I'd like a macro which opens a window in which all those fields are
listed for me to fill them, and then writes those filled fields in the
File Properties.
Could somebody do this for me or help me to do it?
Many thanks in advance,
Pierre


I'm sorry for my poor English.



Mon, 05 May 2003 03:00:00 GMT  
 VBA and Fields in Word and Excel 97/2000
Hi Christian,

Take a look at "How to create a Userform" at

http://www.mvps.org/word/FAQs/Userforms/CreateAUserForm.htm

to learn how to create a userform.  ON that form, insert controls into which
you will have the user put that information, then instead of the suggested
code that runs when the commanc button is clicked, use the following to set
the information into the Built in document properties:

ActiveDocument.BuiltinDocumentProperties(wdPropertyTitle)=TextBox1

(assuming that TextBox1 is the control into which the Title is entered)

the for the Custom properties, use:

ActiveDocument.CustomDocumentProperties.Add _
    Name:="Client", LinkToContent:=False, Value:=TextBox4, _
    Type:=msoPropertyTypeString

You can name the textboxes on the user form with the names of the properties
that you are entering into them and doing so will make your code easier to
understand.

Please post any follow-up or new questions to the Newsgroups so that others
may benefit therefrom or contribute thereto.

Hope this helps,
Doug Robbins - Word MVP

Quote:
> Good morning everybody.
> I'm new to VBA.
> I'd like to write a macro for Word and or Excel 97/2000, which allows me
> to insert fields in a document/sheet.
> I regularly use the "File - Properties" of a Word or Excel document/sheet
> and fill the fields "Title", "Subject" and "Company" under the summary
> tab. I also create a "Client", a "Date" and a "Suivi" field under the
> custom tab.
> So I'd like a macro which opens a window in which all those fields are
> listed for me to fill them, and then writes those filled fields in the
> File Properties.
> Could somebody do this for me or help me to do it?
> Many thanks in advance,
> Pierre


> I'm sorry for my poor English.



Wed, 07 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VBA and Fields in Word and Excel 97/2000

2. VBA and Fields in Word and Excel 97/2000

3. Excel 97 VBA vs Excel 2000 VBA

4. Compatibility Problem Using MS Excel 97 VBA on Excel 2000/XP - Causes crashes

5. vba problem word 97 and not word 2000

6. Differences between VBA for Word 2000 and Word 97

7. Word 97 and Word 2000 VBA - Functionality Lost?

8. Import From Excel 2000 with VBA code into Access 97

9. How do you send Outlook 2000 email using WORD 97 VBA Macro

10. Word 2000/97 & VBA

11. Access 97/2000 Field in Word Document

12. convert vba 2000 to vba 97

 

 
Powered by phpBB® Forum Software