borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (vba to vb possibly?)Next Topic (Outlook Express) New Topic New Poll Post Reply
AndreaVB Forum : VBA (Access, Excel, Word, ...) : Using Variables with VB & Word
Poster Message
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 305

icon 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
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1159
icon Re: Using Variables with VB & Word

I think you just have to remove the quotes.

Set oDoc = oWord.Documents.Open(FileName:= letterfile , _
    ReadOnly:=True)






[Edited by steve_w on 18-06-2003 at 03:13 PM GMT]

18-06-2003 at 03:13 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VBA (Access, Excel, Word, ...) : Using Variables with VB & Word
Previous Topic (vba to vb possibly?)Next Topic (Outlook Express) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder