
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.