CWT
11-27-2013, 10:07 AM
I have a drop down menu that I have created in Word which I would like to attach macro's to. Each macro will point to a different PDF file, so when the user clicks the menu option it will open the specific PDF.I have found the code below. It seems to work, but when I go to try and attach it it is not in my list of macro's. How do I get it to show in my list. Will I need to create a new module for each PDF macro if I use the below code? What I would like is one module, but the code repeated and only the file path for each macro will be changed. Hope that make sense. Option Explicit 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 Private Sub Document_Open() ShellExecute 0&, "open", "C:\SomeFile.pdf", vbNullString, "C:\", 1 End Sub