Opening up a file on click

J

jtfalk

Good day,

i have lookedand found some code that looks to be what I need but have a
little twist on it. I want to click on an icon and have the file open up. I
need the folder to loot at Combo1 is the file name (without the .xls on it)
and Combo100 to get the folder name but when I look in explorer I need it to
look for this from the 5th character out. For example Combo100 = north desk,
the file folder is 100. north desk and Combo1 = mikesdesk with the file name
as mikedesk.xls.
Any help would be appreciated

Public Function fsFoldersearch(strProdType As String, strFolderSerial As
String)

Const strPathF As String = "G:\WO\"
Const strPathM As String = "\Scans\"
Const strPathDiv As String = "\"
Dim strFolder As String

strFolder = Dir(strPathF & strProdType & strPathDiv & -
strFolderSerial & "*", vbDirectory)
If strFolder <> "" Then
MsgBox "The Product has not been completed.", vbOKOnly, _
"Not Completed"
Shell Chr(34) & "EXPLORER.EXE" & Chr(34) & " " & _
Chr(34) & strPathF & strProdType & strPathDiv & _
strFolderSerial & Chr(34), vbNormalFocus
Else
strFolder = Dir(strPathF & strProdType & strPathM & _
strFolderSerial & "*", vbDirectory)
If strFolder <> "" Then
Shell Chr(34) & "EXPLORER.EXE" & Chr(34) & " " & _
Chr(34) & strPathF & strProdType & strPathM & _
strFolder & Chr(34), vbNormalFocus
Else
MsgBox "Folder does not exist", vbOKOnly, "No Folder"
End If
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top