Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default open a word file from xl

how do i open a txt file in word using vba?

file name and path is C:\Test.txt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default open a word file from xl

ChangeFileOpenDirectory "C:\"
Documents.Open FileName:="RESETLOG.TXT",
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto



-----Original Message-----
how do i open a txt file in word using vba?

file name and path is C:\Test.txt
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default still need help

thanks 4 posting

i tried what you said and it did not work

the version of xl im using is 97,

i hit the object browser and could not find documents in
their. pls help me




-----Original Message-----
ChangeFileOpenDirectory "C:\"
Documents.Open FileName:="RESETLOG.TXT",
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="",

Format:=wdOpenFormatAuto



-----Original Message-----
how do i open a txt file in word using vba?

file name and path is C:\Test.txt
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default still need help

On way:

Option Explicit
Sub testme01()

Dim oWord As Object
Dim myWordDocument As String
Dim testStr As String

myWordDocument = "c:\test.txt"

testStr = ""
On Error Resume Next
testStr = Dir(myWordDocument)
On Error GoTo 0
If testStr = "" Then
MsgBox myWordDocument & " doesn't exist"
Exit Sub
End If

On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = CreateObject("Word.Application")
End If

oWord.Visible = True
oWord.Documents.Open myWordDocument

End Sub

steve wrote:

thanks 4 posting

i tried what you said and it did not work

the version of xl im using is 97,

i hit the object browser and could not find documents in
their. pls help me

-----Original Message-----
ChangeFileOpenDirectory "C:\"
Documents.Open FileName:="RESETLOG.TXT",
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="",

Format:=wdOpenFormatAuto



-----Original Message-----
how do i open a txt file in word using vba?

file name and path is C:\Test.txt
.

.


--

Dave Peterson

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
How to open a new instance of Word and its .doc file Launchnet Excel Worksheet Functions 3 June 18th 07 06:20 PM
Hyperlink to open Word File Curt Excel Discussion (Misc queries) 7 January 14th 07 12:47 PM
when opening a .xls file it seems to want to open in word, what d deniseh Excel Discussion (Misc queries) 4 March 17th 06 01:50 PM
open word file? pgoodale[_3_] Excel Programming 1 December 31st 03 01:15 PM
Graph Excel Selection, Open Word File, Embed Graph Into Word Steve Excel Programming 0 November 17th 03 05:35 PM


All times are GMT +1. The time now is 07:10 AM.

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"