Right now I have a vba macro in excel that directly links cells in a workbook to bookmarks in a word document. The document containing the bookmarks is hard coded into the macro. Ultimately, multiple users will have access to this macro enabled workbook and download it off a shared drive which creates a problem with everyone having different folder structures. I'm looking for a way to open a dialog box to prompt users to select the file path of the word document containing the bookmarks rather than have it hard coded.
As you can see the code points to a specific workbook and specific sheet as well as a specific document then begins filling the specified bookmarks. I'm hoping to find a way for the users to not have to alter the code manually but rather be able to select and use a file path via a dialog box the opens when you run the macro.
Thanks in advance for the help!
Code:
Sub BDOPS()
Dim objWord As Object
Dim ws As Worksheet
Set ws = Workbooks("Pricing Macro Enabled").Sheets("Details")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open "C:\Users\Desktop\BDOPS Handoff.docx"
With objWord.ActiveDocument
.Bookmarks("E2").Range.Text = ws.Range("E2").Text
.Bookmarks("E5").Range.Text = ws.Range("E5").Text
End Sub
As you can see the code points to a specific workbook and specific sheet as well as a specific document then begins filling the specified bookmarks. I'm hoping to find a way for the users to not have to alter the code manually but rather be able to select and use a file path via a dialog box the opens when you run the macro.
Thanks in advance for the help!