View Single Post
 
Old 08-02-2011, 10:17 AM
xena2305 xena2305 is offline Windows XP Office 2007
Novice
 
Join Date: Aug 2011
Posts: 1
xena2305 is on a distinguished road
Default Compile error: sub or function not defined..

Hi,
i got a code that export sheet to a text file from the web, the code works
excelent in my home pc excel 2007 but i get the error i mentioned
when i try to run the same code on my work pc in excel 2003 @2007 both.
google has alot of info about this kind of error but i still cant solve it.
i got the code from http://www.cpearson.com/excel/ImpText.aspx
i attach the first part of the code.

Sub DoTheExport()
Dim FileName As Variant
Dim Sep As String
FileName = Application.GetSaveAsFilename(InitialFileName:=vbN ullString, FileFilter:="Text Files (*.txt),*.txt")
If FileName = False Then
''''''''''''''''''''''''''
' user cancelled, get out
''''''''''''''''''''''''''
Exit Sub
End If
Sep = Application.InputBox("Enter a separator character.", Type:=2)
If Sep = vbNullString Then
''''''''''''''''''''''''''
' user cancelled, get out
''''''''''''''''''''''''''
Exit Sub
End If
Debug.Print "FileName: " & FileName, "Separator: " & Sep
ExportToTextFile FName:=CStr(FileName), Sep:=CStr(Sep), _
SelectionOnly:=False, AppendData:=False
End Sub
Reply With Quote