D
DawnTreader
Hello All
i have a bit of code that i am using trying to open a file. the code works for the most part, except when i put in a wildcard in the filename. when i do so it just opens "my documents".
here is the code:
Private Sub cmdOpenModel_Click()
Dim setFileName As String
Dim setPath As String
setPath = DLookup("VariableValue", "tblSystemVariables", "VariableName = 'ModelPathDefault'") '& "'"
setFileName = Me.SetNumber & "*.lxf"
MsgBox setPath & setFileName
If Dir(setPath & setFileName) <> "" Then
Shell Chr(34) & "EXPLORER.EXE" & Chr(34) & " " & setPath & setFileName & Chr(34), vbNormalFocus
Else
MsgBox "No Model available"
End If
End Sub
the *.lxf doesnt work, why? if i take it out it works fine. i need it to work with the wildcard so that it doesnt matter if the file name is longer than the number i pass to the code. i thought it was working yesterday, but it seems to have changed.
any and all help appreciated.
i have a bit of code that i am using trying to open a file. the code works for the most part, except when i put in a wildcard in the filename. when i do so it just opens "my documents".
here is the code:
Private Sub cmdOpenModel_Click()
Dim setFileName As String
Dim setPath As String
setPath = DLookup("VariableValue", "tblSystemVariables", "VariableName = 'ModelPathDefault'") '& "'"
setFileName = Me.SetNumber & "*.lxf"
MsgBox setPath & setFileName
If Dir(setPath & setFileName) <> "" Then
Shell Chr(34) & "EXPLORER.EXE" & Chr(34) & " " & setPath & setFileName & Chr(34), vbNormalFocus
Else
MsgBox "No Model available"
End If
End Sub
the *.lxf doesnt work, why? if i take it out it works fine. i need it to work with the wildcard so that it doesnt matter if the file name is longer than the number i pass to the code. i thought it was working yesterday, but it seems to have changed.
any and all help appreciated.