M
Milton Snider
I have a module which is suppose to generate an xml file and then ftp it to
an ftp server. I am getting an error on the GetShortPathName function which
indicates Sub or Function not defined. The entire code is as follows. The
error is in the GetShortFileName Function which is last. I am on an XP
Professional machine. Any help is appriciated.
thanks
Milton
Dim sXMLPath As String
Public Function UpdateSQL()
On Error GoTo finish
sXMLPath = CurrentProject.Path & "\AccessEXP.xml"
If Dir(sXMLPath) <> "" Then
Kill sXMLPath
MsgBox sXMLPath
End If
ExportXML acExportTable, "mytable", sXMLPath
Call ExportFTP
finish: MsgBox "Error number " & Err.Number & ": " & Err.Description
End Function
Public Function outputhtml()
sXMLPath = CurrentProject.Path & "\AccessEXP.html"
If Dir(sXMLPath) <> "" Then
Kill sXMLPath
MsgBox sXMLPath
End If
ExportXML acExportTable, "mytable", sXMLPath
finish: MsgBox "Error number " & Err.Number & ": " & Err.Description
End Function
Public Sub ExportFTP()
Dim sSCR As String, sDir As String, sExe As String
sSCR = CurrentProject.Path & "\AccessFTP.scr"
sSCR = GetShortFileName(sSCR)
sDir = Environ$("COMSPEC")
sDir = Left$(sDir, Len(sDir) - Len(Dir(sDir)))
sExe = sDir & "ftp.exe -s:" & sSCR
Shell sExe, vbMaximizedFocus
End Sub
Public Function GetShortFileName(ByVal LongFileName As String) As String
Dim buffer As String, length As Long
' Prepare the receiving buffer
buffer = Space$(300)
length = GetShortPathName(LongFileName, buffer, Len(buffer))
' if return value was non-zero, estract the result
' else, it returns a null string (probably
GetShortFileName = Left$(buffer, length)
End Function
an ftp server. I am getting an error on the GetShortPathName function which
indicates Sub or Function not defined. The entire code is as follows. The
error is in the GetShortFileName Function which is last. I am on an XP
Professional machine. Any help is appriciated.
thanks
Milton
Dim sXMLPath As String
Public Function UpdateSQL()
On Error GoTo finish
sXMLPath = CurrentProject.Path & "\AccessEXP.xml"
If Dir(sXMLPath) <> "" Then
Kill sXMLPath
MsgBox sXMLPath
End If
ExportXML acExportTable, "mytable", sXMLPath
Call ExportFTP
finish: MsgBox "Error number " & Err.Number & ": " & Err.Description
End Function
Public Function outputhtml()
sXMLPath = CurrentProject.Path & "\AccessEXP.html"
If Dir(sXMLPath) <> "" Then
Kill sXMLPath
MsgBox sXMLPath
End If
ExportXML acExportTable, "mytable", sXMLPath
finish: MsgBox "Error number " & Err.Number & ": " & Err.Description
End Function
Public Sub ExportFTP()
Dim sSCR As String, sDir As String, sExe As String
sSCR = CurrentProject.Path & "\AccessFTP.scr"
sSCR = GetShortFileName(sSCR)
sDir = Environ$("COMSPEC")
sDir = Left$(sDir, Len(sDir) - Len(Dir(sDir)))
sExe = sDir & "ftp.exe -s:" & sSCR
Shell sExe, vbMaximizedFocus
End Sub
Public Function GetShortFileName(ByVal LongFileName As String) As String
Dim buffer As String, length As Long
' Prepare the receiving buffer
buffer = Space$(300)
length = GetShortPathName(LongFileName, buffer, Len(buffer))
' if return value was non-zero, estract the result
' else, it returns a null string (probably
GetShortFileName = Left$(buffer, length)
End Function