Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a new template in Word

Status
Not open for further replies.

pippi1814

Programmer
Feb 9, 2004
6
0
0
NL
Hi there,

I haven't used VBA in years and have to do some stuff with it again.
I have a combobox on my form in Word 2000 and when the user selects an item I want to open another template (based on which item the user selected) and then I want to add some specific information in the new form.
I have no clue on how to do this, but I know it's possible.
Can someone help me out with some code sample?
 
Hi pippi

This should get you started. I don't really know Word VBA so I'm not in much of a position to help with populating your new form once it's open but this will open it.

I used a listbox (with values 1, 2 & 3) and built in templates but you'll get the idea!

Code:
Private Sub ListBox1_Click()
Select Case ListBox1.Value
Case Is = 1
    Documents.Add Template:= _
        "C:\Program Files\Microsoft Office\Templates\1033\Contemporary Memo.dot", _
         NewTemplate:=False, DocumentType:=0
Case Is = 2
    Documents.Add Template:= _
        "C:\Program Files\Microsoft Office\Templates\1033\Professional Resume.dot" _
        , NewTemplate:=False, DocumentType:=0
Case Is = 3
    Documents.Add Template:= _
        "C:\Program Files\Microsoft Office\Templates\1033\Elegant Fax.dot", _
        NewTemplate:=False, DocumentType:=0
End Select
End Sub

Good Luck
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top