Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Label Click to open Word Document
Hello, I want to be able to click on a label in a userform and do something
in the _Click event that will open a word document. Something like this OpenWord(thisWorkBook.Path & "/guide/guide.doc") I know this Function "OpenWord" doesn't exist, just wondering if anything like it. Thanks in advance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Label Click to open Word Document
ActiveWorkbook.FollowHyperlink Address:="file:///C:\Temp\Number.doc"
-- Gary''s Student - gsnu200799 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Label Click to open Word Document
Here's one that I saved:
Option Explicit Sub testme() 'Dim WDApp As Word.Application 'Dim WDDoc As Word.Document Dim WDApp As Object Dim WDDoc As Object Dim myDocName As String Dim WordWasRunning As Boolean Dim testStr As String myDocName = "C:\my documents\word\doc10.doc" testStr = "" On Error Resume Next testStr = Dir(myDocName) On Error GoTo 0 If testStr = "" Then MsgBox "Word file not found!" Exit Sub End If WordWasRunning = True On Error Resume Next Set WDApp = GetObject(, "Word.Application") If Err.Number < 0 Then Set WDApp = CreateObject("Word.Application") WordWasRunning = False End If WDApp.Visible = True 'at least for testing! Set WDDoc = WDApp.documents.Open(Filename:=myDocName) 'do more stuff???? 'If WordWasRunning Then ' 'leave it running 'Else ' WDApp.Quit 'End If Set WDDoc = Nothing Set WDApp = Nothing End Sub NateBuckley wrote: Hello, I want to be able to click on a label in a userform and do something in the _Click event that will open a word document. Something like this OpenWord(thisWorkBook.Path & "/guide/guide.doc") I know this Function "OpenWord" doesn't exist, just wondering if anything like it. Thanks in advance! -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Label Click to open Word Document
Thanks a lot. One of those simple things I've not done yet and couldn't
remember. Thanks for your guiding reply. "Gary''s Student" wrote: ActiveWorkbook.FollowHyperlink Address:="file:///C:\Temp\Number.doc" -- Gary''s Student - gsnu200799 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Label Click to open Word Document
You are very welcome!
The method in Peterson's post should be used if you need to control the Word app from VBA -- Gary''s Student - gsnu200799 "NateBuckley" wrote: Thanks a lot. One of those simple things I've not done yet and couldn't remember. Thanks for your guiding reply. "Gary''s Student" wrote: ActiveWorkbook.FollowHyperlink Address:="file:///C:\Temp\Number.doc" -- Gary''s Student - gsnu200799 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data from spreadsheet to Microsoft Word label document | Excel Discussion (Misc queries) | |||
open a new word document | Excel Discussion (Misc queries) | |||
open word document | Excel Programming | |||
Open a Word Document | Excel Programming | |||
Embedded Word Document not painted until I click on it and activate it with the mouse | Excel Programming |