![]() |
Opening WORD from Excel
Hello, I am using the following code to open and WORD document on my
computer. However I need to send it to a bunch of people and although the files will be place in a central location, the path that I'm using isn't accurate for their machines. How can I change the code to look for each individual document (named the same as on my computer) and update the path? Private Sub CommandButton1_Click() Dim wd As Object Set wd = CreateObject("Word.Application") wd.Visible = True wd.Documents.Open ("C:\Documents and Settings\BOB REYNOLDS\Desktop\Forms-Letters-COJ\Letters & Merge Data\L01 Appointment Letter 06282004.doc") End Sub The new folder will be on the desktop, but someone else's name. Thanks so much Bob Reynolds |
Opening WORD from Excel
Bob,
Something like Set objShell = CreateObject("Shell.Application") Set objFolderMyDesk = objShell.Namespace(&H10&) strMyDeskPath = objFolderMyDesk.Self.Path will return "strMyDeskPath" as the path string to the individual user's desktop. If building a path statement, don't forget to include the backslash &"\"& with the subfolder and file name after. Steve "Bob Reynolds" wrote in message ... Hello, I am using the following code to open and WORD document on my computer. However I need to send it to a bunch of people and although the files will be place in a central location, the path that I'm using isn't accurate for their machines. How can I change the code to look for each individual document (named the same as on my computer) and update the path? Private Sub CommandButton1_Click() Dim wd As Object Set wd = CreateObject("Word.Application") wd.Visible = True wd.Documents.Open ("C:\Documents and Settings\BOB REYNOLDS\Desktop\Forms-Letters-COJ\Letters & Merge Data\L01 Appointment Letter 06282004.doc") End Sub The new folder will be on the desktop, but someone else's name. Thanks so much Bob Reynolds |
All times are GMT +1. The time now is 02:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com