LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default PS Opening Word with a specific document from excel vba

To open the word application and then a specific document I use late
binding and the following code (you need to replace
"H:\DriveName\FolderName\MyDocument.Doc" with your own document and
pathway):

Dim WordApplication As Object

Sub OpenFileNote()

Call OpenWord

With WordApplication
.WindowState = 1
.Visible = True
.documents.Open
Filename:="H:\DriveName\FolderName\MyDocument.Doc"
End With

End Sub

Private Function OpenWord()

Dim strApp As String
strApp = "Word.Application"
'check to see if Word is running
On Error Resume Next
If Not IsRunning(strApp) Then
Set WordApplication = CreateObject(strApp)
Else
Set WordApplication = GetObject(, strApp)
End If
On Error GoTo 0
strApp = ""

End Function

Public Function IsRunning(ByVal myAppl As String) As Boolean

Dim applRef As Object
On Error Resume Next

Set applRef = GetObject(, myAppl)

If Err.Number = 429 Then
IsRunning = False
Else
IsRunning = True
End If

Set applRef = Nothing

End Function

(EARLY BINDING IS THE OTHER APPROACH)

HOPE THIS HELPS
JASON

"JRB" wrote in message ...
I omitted to mention that the procedures have to be compatible with Excel 97

"JRB" wrote in message
...
Is it possible to open Word with a specific document from an excel

procedure

I have managed to open word using:
Application.ActivateMicrosoftApp xlMicrosoftWord
but can find no way to specify the document to load

I would like to run a mail merge, using Word, to create some mailing

labels,
print them and then return to Excel and closing the Word program

Any (and all) suggestions greatly appreciated

TIA


 
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
Opening word document through excel vba srinums Excel Discussion (Misc queries) 0 June 8th 06 12:02 PM
Opening Word Document with excel [email protected] Excel Discussion (Misc queries) 0 March 21st 05 01:49 AM
getting specific info from a word document into excel smintey Excel Discussion (Misc queries) 3 December 8th 04 08:20 PM
opening a word document from excel chris Excel Programming 5 April 1st 04 03:17 PM
Opening a Word Document in Excel Tonja Excel Programming 2 September 18th 03 02:56 AM


All times are GMT +1. The time now is 09:55 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"