Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening Word in Excel

Hi. I'm trying to open a word document via a userform button so that I can
mailmerge from Excel. Anyone know how to do that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening Word in Excel


This (can be) a big subject so here is just a hint.

You have to reference the word object library in the VBA referemces
which will give you access to the word objects.

I tend to develop the code for controlling the word documnet in word
and then paste it into Excel. I find it easier to test and debug that
way. If I am working with several word documents I either set up the
code for handling these as seperate routines in Excel (so that if I
change the word document the code is clearly recognisable. Or keep the
code in the word document and pass the values over by wetting up
properties.

Without knowing clearly what you are trying to do and your level of
expertise it is difficult to know how to answer this.

regards


--
tony h
------------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074
View this thread: http://www.excelforum.com/showthread...hreadid=513121

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening Word in Excel

Here are some sources of information you can consult:

Microsoft Office 97 Automation Help File Available (Q167223)
http://support.microsoft.com/default...b;EN-US;167223

Microsoft Office 2000 Automation Help File Available (Q260410)
http://support.microsoft.com/default...b;EN-US;260410

Microsoft Office XP Automation Help File Available (Q302460)
http://support.microsoft.com/default...b;EN-US;302460

http://msdn.microsoft.com/library/en...ortal_7l45.asp
Automation Programmer's Reference


http://support.microsoft.com/default...b;EN-US;253235
FILE: OFFAUTMN.EXE Discusses Office 97 and 2000 Automation and Provides
Sample Code

--
Regards,
Tom Ogilvy

"tony h" wrote in
message ...

This (can be) a big subject so here is just a hint.

You have to reference the word object library in the VBA referemces
which will give you access to the word objects.

I tend to develop the code for controlling the word documnet in word
and then paste it into Excel. I find it easier to test and debug that
way. If I am working with several word documents I either set up the
code for handling these as seperate routines in Excel (so that if I
change the word document the code is clearly recognisable. Or keep the
code in the word document and pass the values over by wetting up
properties.

Without knowing clearly what you are trying to do and your level of
expertise it is difficult to know how to answer this.

regards


--
tony h
------------------------------------------------------------------------
tony h's Profile:

http://www.excelforum.com/member.php...o&userid=21074
View this thread: http://www.excelforum.com/showthread...hreadid=513121



  #4   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Opening Word in Excel

In my situation, I have Word document names in a spreadsheet. All docs
listed are in the same folder as the workbook. This code gets the doc name
from the ActiveCell, and the doc file path from the workbook path. You will
need to adjust as required (you may want to use the BuiltIn FileOpen dialog
instead).

HTH
Ed

Sub FindDoc()

' ******
' NOTE: Use only _one_ of the bindings below.
' Comment out the other one. I have the early binding
' to help code, but use the late binding to run
' because I don't know the user's versions.

'Dim WD As New Word.Application
Dim WD As Object

' *******
Dim doc As String
Dim Fname As String
Dim Fpath As String

Err.Clear

' Get file path
Fpath = ThisWorkbook.Path

Sheets("Sheet1").Activate

' Get doc name from list page
Fname = ActiveCell.Text

' Open doc
doc = Fpath & "\" & Fname & ".doc"

On Error Resume Next
Set WD = GetObject(, "Word.Application")
If Err.Number < 0 Then
Set WD = CreateObject("Word.Application")
End If
Err.Clear
On Error GoTo 0

WD.Documents.Open doc
WD.Visible = True
WD.Quit
Set WD = Nothing
End Sub

"Jeralc" <u18775@uwe wrote in message news:5bf5e9a660038@uwe...
Hi. I'm trying to open a word document via a userform button so that I can
mailmerge from Excel. Anyone know how to do that?



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 a Word Template from within Excel perry Excel Discussion (Misc queries) 0 January 30th 07 12:23 PM
Opening Word from Excel David Excel Programming 4 June 6th 05 03:37 PM
Opening WORD from Excel Bob Reynolds[_3_] Excel Programming 1 August 4th 04 04:07 AM
Excel-Opening Word AW Excel Programming 0 April 2nd 04 09:21 AM
opening a word document from excel chris Excel Programming 5 April 1st 04 03:17 PM


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