Hi there, i am in need of some incredibly urgent help.
I have a code that pulls out specific cells from a closed .csv file, and puts it in a "master sheet". The CSV file contains information Exported from Outlook Tasks. here is the code that takes the information from the.CSV file:
[vba]Function doFileQuery(filename As String, outSheet As String)
Dim R, c As Integer
Dim rootDir As String
rootDir = "G:\Infrastructure Services\Engineering Services\Task Lists" 'this is the folder where the task list files are saved
Dim connectionName As String
connectionName = "TEXT;" + rootDir + "\" + filename 'Goes into the specified drive and specified directory
On Error Resume Next
With Worksheets(outSheet).QueryTables.Add(Connection:=connectionName, Destination:=Worksheets(outSheet).Range("A1")) 'creates conntection to a "database" (allows the program to run without the target spreadsheet being open
.Name = filename
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells 'overwrites any previous information (ie old tasks)
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True 'makes column wide enough to fit information
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False 'loops arround the prompt to import data (makes the assumption that seeing as the user is running the import function, the user wants the information imported)
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited 'uses the commas in the .CSV file to make a new collumn
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.Refresh BackgroundQuery:=False
If Err = 1004 Then
MsgBox (outSheet & "'s task list has not been imported")
Else
End If
End With
End Function[/vba]
when it imports the "notes" section, there is a huge problem in the import - it still works, but it puts the information in several different cells.
My planned solution is to cycle through the text in the particular cell, until it finds a special character (as i only need the first line of text) and import everything infront of the special character. how would i go about doing this?????