Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JRB JRB is offline
external usenet poster
 
Posts: 10
Default Opening Word with a specific document from excel vba

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
JRB JRB is offline
external usenet poster
 
Posts: 10
Default PS Opening Word with a specific document from excel vba

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




  #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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Opening Word with a specific document from excel vba

Hi JRB

Try this example that print a Word file

Sub test()
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("C:\ron.doc")
WD.ActiveDocument.PrintOut Background:=False
WD.ActiveDocument.Close
WD.Quit
Set WD = Nothing
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Opening Word with a specific document from excel vba

Thanks Ron ... That definitely works a treat
Unfortunately it printed the document before the mailmerge took place
Have you any suggestions as to how I can force the mailmerge prior to
printing

Thanks again from the prompt and accurate response
This NG must be one of the best

"Ron de Bruin" wrote in message
...
Hi JRB

Try this example that print a Word file

Sub test()
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("C:\ron.doc")
WD.ActiveDocument.PrintOut Background:=False
WD.ActiveDocument.Close
WD.Quit
Set WD = Nothing
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Opening Word with a specific document from excel vba

I never try that

Maybe David's site have a answer for you
http://www.mvps.org/dmcritchie/excel/mailmerg.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"sa3214 @eclipse.co.uk" <jimburton<REMOVE wrote in message ...
Thanks Ron ... That definitely works a treat
Unfortunately it printed the document before the mailmerge took place
Have you any suggestions as to how I can force the mailmerge prior to printing

Thanks again from the prompt and accurate response
This NG must be one of the best

"Ron de Bruin" wrote in message ...
Hi JRB

Try this example that print a Word file

Sub test()
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Documents.Open ("C:\ron.doc")
WD.ActiveDocument.PrintOut Background:=False
WD.ActiveDocument.Close
WD.Quit
Set WD = Nothing
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"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








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
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 12:29 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"