Showing posts with label Import data from notepad. Show all posts
Showing posts with label Import data from notepad. Show all posts

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
errhl:
Exit Sub
End Sub

Import data from SQL

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