Wednesday, July 14, 2010

VBA Code to Import data from notepad

Sub importnotepad()
On Error GoTo errhl
Dim notepadfile
notepadfile = Application.GetOpenFilename("Text Files (*.txt),*.txt", , "Please select text file...")
Workbooks.OpenText FileName:=notepadfile, Origin:=xlWindows, StartRow:=1
With ActiveWorkbook
ActiveSheet.Move After:=.Worksheets(.Worksheets.Count)
End With
Exit Sub
End Sub

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...