Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Assign a variable to a word document

Hello,

I have done this before but I lost my notes... How do you assign a variable
to a Word document when you open it? I thought the following codes would be
enough but it gives me the "type mismatch" error. Thanks for you help!

Sub xyz()

Dim WordApp As Word.Application
Dim LetterTemplate As Word.Document

Set WordApp = New Word.Application
WordApp.Visible = True
Set LetterTemplate = WordApp.Documents.Open(Filename:="Blah Blah Blah",
ReadOnly:=True)

End sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Assign a variable to a word document

Anson,

Your code works fine for me, as long as I use a fully qualified, proper doc
path.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Anson" wrote in message
...
Hello,

I have done this before but I lost my notes... How do you assign a

variable
to a Word document when you open it? I thought the following codes would

be
enough but it gives me the "type mismatch" error. Thanks for you help!

Sub xyz()

Dim WordApp As Word.Application
Dim LetterTemplate As Word.Document

Set WordApp = New Word.Application
WordApp.Visible = True
Set LetterTemplate = WordApp.Documents.Open(Filename:="Blah Blah Blah",
ReadOnly:=True)

End sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign value to a variable name Gnarlodious Excel Discussion (Misc queries) 2 August 20th 06 07:10 AM
how do I import variable data into a word document GaryPick Excel Discussion (Misc queries) 1 March 30th 06 03:49 PM
Assign value to variable rroach Excel Discussion (Misc queries) 1 July 13th 05 05:24 AM
Variable VB to assign new sheet name Kevin M Excel Worksheet Functions 0 June 17th 05 12:15 AM
assign variable Tim Excel Programming 10 October 1st 04 07:33 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"