Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Label Click to open Word Document

ActiveWorkbook.FollowHyperlink Address:="file:///C:\Temp\Number.doc"
--
Gary''s Student - gsnu200799
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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
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
Data from spreadsheet to Microsoft Word label document BDHale Excel Discussion (Misc queries) 2 April 2nd 08 01:36 AM
open a new word document Ciara Excel Discussion (Misc queries) 1 May 18th 05 11:04 AM
open word document kari Excel Programming 1 August 30th 04 02:47 AM
Open a Word Document Frank[_19_] Excel Programming 1 February 5th 04 08:09 PM
Embedded Word Document not painted until I click on it and activate it with the mouse Chad Knudson Excel Programming 1 July 23rd 03 09:58 PM


All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"