T
Tiffany
Hi,
I am using the following code:
Function Get_FileName(prmstrDialog, prmstrFileName) As String
Dim strFilter As String
Dim lngFlags As Long
Dim loclngJ As Long
Dim loclngTempPos As Long
Dim loclngPosition As Long
Dim locblnFinished As Boolean
WrongFileName:
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", _
"*.xls")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
If (gblstrDirectory = "") Then
gblstrDirectory = "C:\"
End If
Get_FileName = ahtCommonFileOpenSave(InitialDir:=gblstrDirectory, _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:=prmstrDialog)
If (Get_FileName <> "") Then
If (InStr(1, Get_FileName, prmstrFileName) = 0) Then
MsgBox "Error you have selected the wrong filename" & vbCrLf &
vbCrLf & _
prmstrDialog & ".", vbCritical
GoTo WrongFileName
Else
loclngPosition = 1
locblnFinished = False
Do Until locblnFinished
loclngTempPos = InStr(loclngPosition + 1, Get_FileName, "\")
If (loclngTempPos <> 0) Then
loclngPosition = loclngTempPos
Else
locblnFinished = True
gblstrDirectory = Mid(Get_FileName, 1, loclngPosition - 1)
End If
Loop
End If
Else
End
End If
End Function
And then using the TransferSpreadsheet argument in the macro to import the
actual file. How can I use VBA and use the RunCode() argument to import the
file??
I am using the following code:
Function Get_FileName(prmstrDialog, prmstrFileName) As String
Dim strFilter As String
Dim lngFlags As Long
Dim loclngJ As Long
Dim loclngTempPos As Long
Dim loclngPosition As Long
Dim locblnFinished As Boolean
WrongFileName:
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", _
"*.xls")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
If (gblstrDirectory = "") Then
gblstrDirectory = "C:\"
End If
Get_FileName = ahtCommonFileOpenSave(InitialDir:=gblstrDirectory, _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:=prmstrDialog)
If (Get_FileName <> "") Then
If (InStr(1, Get_FileName, prmstrFileName) = 0) Then
MsgBox "Error you have selected the wrong filename" & vbCrLf &
vbCrLf & _
prmstrDialog & ".", vbCritical
GoTo WrongFileName
Else
loclngPosition = 1
locblnFinished = False
Do Until locblnFinished
loclngTempPos = InStr(loclngPosition + 1, Get_FileName, "\")
If (loclngTempPos <> 0) Then
loclngPosition = loclngTempPos
Else
locblnFinished = True
gblstrDirectory = Mid(Get_FileName, 1, loclngPosition - 1)
End If
Loop
End If
Else
End
End If
End Function
And then using the TransferSpreadsheet argument in the macro to import the
actual file. How can I use VBA and use the RunCode() argument to import the
file??