Hi,
First time poster, many time reader. I have a macro to find me a document from a certain details, but in some circumstances their may be multiple applicable documents, I know nothing of user forms, but how to I find all the documents, show their "modified date", "Name","File type" and select one or which several to open.
My current code:
To have something more like a form popup showing for a search within a folder for files containing 'Brians Store':
Open? Name Date
O "Quote Brians Store - ProductsA.xlsm" 1/2/12
O "Quote Brians Store - ProductsB.xlsm" 1/1/12
O "Quote Brians Store - ProductsA.xlsm" 1/5/11
O "Quote Brians Store - ProductsC.xlsm" 1/4/11
And I may want to open the 1st, 2nd and last files.
First time poster, many time reader. I have a macro to find me a document from a certain details, but in some circumstances their may be multiple applicable documents, I know nothing of user forms, but how to I find all the documents, show their "modified date", "Name","File type" and select one or which several to open.
My current code:
Code:
[/COLOR]Private Sub OpenPDF()
Dim Ans
Dim TheFile As String
Dim ThePath As String, LocationD
Dim R
R = ActiveCell.Row
ThePath = "H:folders"
Ans = MsgBox("Do you want the PDF? (no gives excel)", vbYesNo, "PDF or Excel")
If Ans = vbYes Then
TheFile = Dir(ThePath & "*" & customersname & "*" & ".pdf")
LocationD = ThePath & TheFile
ElseIf Ans = vbNo Then
TheFile = Dir(ThePath & "*" & customername & "*" & ".xlsm")
LocationD = ThePath & TheFile
End If
ActiveWorkbook.FollowHyperlink LocationD
End Sub
[COLOR=#333333]
To have something more like a form popup showing for a search within a folder for files containing 'Brians Store':
Open? Name Date
O "Quote Brians Store - ProductsA.xlsm" 1/2/12
O "Quote Brians Store - ProductsB.xlsm" 1/1/12
O "Quote Brians Store - ProductsA.xlsm" 1/5/11
O "Quote Brians Store - ProductsC.xlsm" 1/4/11
And I may want to open the 1st, 2nd and last files.