I can't seem to figure this one out.
I have a Toolbar button with a hyperlink to a MS WORD document, I would like to make it a Macro.
I can't seem to figure this one out.
I have a Toolbar button with a hyperlink to a MS WORD document, I would like to make it a Macro.
Regards
Rick
Win10, Office 365
This will open the file whether Word is already open or not
and give it focus
![]()
Sub StartWordFile() Dim docWord As Object Set docWord = CreateObject("Word.Application") docWord.Visible = True docWord.Documents.Open Filename:="C:\Documents and Settings\....full path here.....doc" End Sub
Good afternoon Rick_Stanich
There are a number of ways to do this but this is my favourite. Basically, it will open any file using the default Windows viewer.
HTH![]()
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Sub test() On Error Resume Next ShellExecute 0&, vbNullString, "D:\Work\MyFile.doc", vbNullString, vbNullString, vbNormalFocus End Sub
DominicB
Please familiarise yourself with the rules before posting. You can find them here.
Thank you!!!
This has helped alot!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks