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

Visual Basic

Status
Not open for further replies.

paanis

Programmer
Joined
Jul 22, 2001
Messages
1
Location
US
Hi,

How can Open a TEXT file with MS- word, not with the notepad.exe using shellExecuteex or another API.

thanks
Anis
 
I have never worked with it, but I would check out the Microsoft word object library in references. You should be able to specify your txt file and launch from there.
 
Add a reference to Microsoft Word X.0 object library first:

Option Explicit

Private Sub Command1_Click()
Dim MSWord As Word.Application
Set MSWord = New Word.Application

MSWord.Documents.Open "c:\MyTxt.txt"
MSWord.WindowState = wdWindowStateMaximize
MSWord.Visible = True

Set MSWord = Nothing

End Sub
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top