Shady Level: VB Guru Registered: 08-07-2002 Posts: 305
Using Variables with VB & Word
I need to use the variable LETTERFILE to represent the name of the file I wish to open, I have a procedure written that will fill in the name and address section of the letter, but depending on who the letter is being sent to it may change the template I wish to use.
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Open(FileName:="& letterfile &", _
ReadOnly:=True)
So how do you pass a variable into the above??
Shady
____________________________
I don't wanna die... but I ain't keen on livin' either
18-06-2003 at 03:09 PM
|
steve_w Level: Moderator Registered: 18-04-2003 Posts: 1159
Re: Using Variables with VB & Word
I think you just have to remove the quotes.
Set oDoc = oWord.Documents.Open(FileName:= letterfile , _
ReadOnly:=True)