Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks Jim, I finally got it to work. I recorded a new macro "inside the same workbook" i have been working with. And copied and inserted the macro code into my code. And it works like charm. This is what i have now. Code: -------------------- Private Sub wkscmd_ImportData_Click() ' Local Variables Dim strPath As String, strFile As String ' Get Data file parameters strPath = Me.Range("C1") strFile = Me.Range("C2") ' Verify that table is empty Me.Range("rdi_TableTop", "A" & Me.Range("A65536").End(xlDown).Row).EntireColumn.C learContents ' Open and import datafile ' Open file Application.DisplayAlerts = False On Error Goto Err_BadFileName Range("rdi_TableTop").Select With Selection.QueryTable .Connection = "TEXT;" & strPath & strFile .TextFilePlatform = 1252 .TextFileStartRow = 1 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = False .TextFileSemicolonDelimiter = False .TextFileCommaDelimiter = False .TextFileSpaceDelimiter = False .TextFileOtherDelimiter = "*" .TextFileColumnDataTypes = Array(1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With Application.DisplayAlerts = True Exit_BadFileName: Exit Sub Err_BadFileName: MsgBox "Please enter the correct FilePath in CELL C1, e.g. C:\myfolder\ " _ & Chr(13) & "Be sure to have a slash behind your Filepath as shown above" _ & Chr(13) & "And enter the correct FileName in CELL C2, e.g. rawdata.txt", vbOKOnly + vbCritical, "Bad Filepath OR FileName" Resume Exit_BadFileName End Sub -------------------- Thanks for your help and taking the time to look at my code :) -- Mslady ------------------------------------------------------------------------ Mslady's Profile: http://www.excelforum.com/member.php...o&userid=27776 View this thread: http://www.excelforum.com/showthread...hreadid=473001 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Importing MM:SS From Tab Delimited File and Charting | Charts and Charting in Excel | |||
Importing Comma delimited file | Excel Discussion (Misc queries) | |||
importing a tab delimited file | Excel Programming | |||
Importing tab delimited files into Excel | Excel Programming | |||
Problem Importing Delimited Data from IE | Excel Programming |