Thru wonderful suggestions I found on the forum, I was able to create a macro to launch Word documents. I use a combo box to call the macro, and it works fine.
However, the group that creates the report has changed the format, and now creates it as a PDF instead of a .doc file.
Can a macro be used to open a PDF?
Here is the code I am using to open the Word docs. I was hoping to add something to this, if at all possible.
So my code makes sense, each month's worth of reports are stored in a different directory. My 'range' references help identify the appropriate directory. I included a Msg box so any staff member who selects a report in a month that includes the new .pdf format will understand why they don't get their report. Darn department, this thing worked well until they changed formats!!
Any help and all suggestions are greatly appreciated!
Kind regards,
Lee
ps: If a macro can't open a .pdf, can it open a directory window? I'm thinking that if the .pdf idea doesn't work, they can still click a button to open a directory window so they can manually select a month-specific sub-directory and then double-click on the daily report they are interested in.
+++++++++++++++++++++
Sub opendoc()
Dim valMonth
Dim valPubDate
Dim valDir
Dim strFilename As String
Dim strPath As String
Set appWD = CreateObject("Word.Application")
valMonth = Sheets("control").Range("D32")
valPubDate = Sheets("control").Range("H37")
valDir = Sheets("control").Range("D46")
strPath = "T:\Corporate Marketing\" & valDir & "\"
strFilename = valPubDate
If valMonth > 1 And valMonth < 7 Then
appWD.Documents.Open Filename:=strPath & strFilename
appWD.Visible = True
ElseIf valMonth > 6 Then
MsgBox "Cannot accesss PDF Files. Working on a Fix."
End If
End Sub
+++++++++++++++++++++++++++
However, the group that creates the report has changed the format, and now creates it as a PDF instead of a .doc file.
Can a macro be used to open a PDF?
Here is the code I am using to open the Word docs. I was hoping to add something to this, if at all possible.
So my code makes sense, each month's worth of reports are stored in a different directory. My 'range' references help identify the appropriate directory. I included a Msg box so any staff member who selects a report in a month that includes the new .pdf format will understand why they don't get their report. Darn department, this thing worked well until they changed formats!!
Any help and all suggestions are greatly appreciated!
Kind regards,
Lee
ps: If a macro can't open a .pdf, can it open a directory window? I'm thinking that if the .pdf idea doesn't work, they can still click a button to open a directory window so they can manually select a month-specific sub-directory and then double-click on the daily report they are interested in.
+++++++++++++++++++++
Sub opendoc()
Dim valMonth
Dim valPubDate
Dim valDir
Dim strFilename As String
Dim strPath As String
Set appWD = CreateObject("Word.Application")
valMonth = Sheets("control").Range("D32")
valPubDate = Sheets("control").Range("H37")
valDir = Sheets("control").Range("D46")
strPath = "T:\Corporate Marketing\" & valDir & "\"
strFilename = valPubDate
If valMonth > 1 And valMonth < 7 Then
appWD.Documents.Open Filename:=strPath & strFilename
appWD.Visible = True
ElseIf valMonth > 6 Then
MsgBox "Cannot accesss PDF Files. Working on a Fix."
End If
End Sub
+++++++++++++++++++++++++++