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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Word from VB

Status
Not open for further replies.

moonoo

Programmer
May 17, 2000
62
US
Hi
How do i open an existing word documnet from VB .
Now i am using the code something like this

Dim word1 As Application
Dim d As Word.Document

Set word1 = GetObject("Word.Application")
Set d = word1.Documents.Add("C:\My.doc")
word1.Application.Visible = True

But its giving problem in the second line.
Do anybody know any other method of opening
an existing help..

Expecting an early reply..
 
Instead of Set d = word1.Documents.Add("C:\My.doc")
do:

word1.Documents.Open ("C:\My.doc")

This should do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top