I'm trying to import the full contents of a text file onto a specific sheet within a specific workbook. I can get it to work using the following code when importing another Excel file, but am having trouble figuring out how to do the same concept with a text file. I'm pretty new to VBA code so any help would be greatly appreciated!
Sample code I use daily for an excel import:
Sub Run_NEW_ROB()
'IDeaS ROB Extract Import
Cur_file = ActiveWorkbook.Name
OldFN = Application.GetOpenFilename(, , "Select IDeaS ROB Extract")
If LCase(OldFN) = "false" Then
MsgBox "You Did Not Select A File - Stopping"
Exit Sub
Else
Workbooks.Open Filename:=OldFN
Set WBK = ActiveWorkbook
End If
Sheets("Hotel").Select
Range("A1:Y366").Copy
Windows(Cur_file).Activate
Sheets("H_CUR").Select
Range("A1").Select
ActiveSheet.Paste
WBK.Activate
Application.CutCopyMode = False
ActiveWindow.Close SaveChanges:=False
Windows(Cur_file).Activate
Workbooks.Open Filename:=OldFN
Set WBK = ActiveWorkbook
Sheets("Market Segments").Select
Range("A1:K10221").Copy
Windows(Cur_file).Activate
Sheets("SEG_CUR").Select
Range("A1").Select
ActiveSheet.Paste
WBK.Activate
Application.CutCopyMode = False
ActiveWindow.Close SaveChanges:=False
Windows(Cur_file).Activate
End Sub