![]() |
macro and button to open a word document from within excel
I would like a macro to automatcially start work and open a sepecific
MicroSoft Word (Office XP version) from with in MicroSoft Excel (Office XP version). |
macro and button to open a word document from within excel
Try the following code
The macro attempts to open a word document called "my_word_document.doc" located in the same directory as the current Excel file The macro also include quite complete error handling statements '----------------------------------------------------- Sub Load_Word_Document( Dim address_str$, xlApp As Objec On Error GoTo load_erro address_str = ThisWorkbook.Pat If Right(address_str, 1) < Application.PathSeparator Then address_str = address_str & Application.PathSeparato address_str = address_str & "my_word_document.doc If Not Dir(address_str) = "" The Set xlApp = CreateObject("Word.Application" xlApp.Documents.Open Filename:=address_st xlApp.Visible = Tru Els MsgBox ("Unable to locate the Word document." End I GoTo exit_jum load_error Shell address_str, vbNormalFocu exit_jump Set xlApp = Nothin On Error GoTo End Su '-------------------------------------------- Regards Edwin Ta http://www.vonixx.co ----- JAJOSEPHESQ wrote: ---- I would like a macro to automatcially start work and open a sepecifi MicroSoft Word (Office XP version) from with in MicroSoft Exce (Office XP version) |
All times are GMT +1. The time now is 06:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com