Importing CSV File

C

chazparks

I have a text file with a series of rows like:
Value1,"Value2â–“Value3",Value4

but when I import the Project is reading it like
Value1,"Value2
Value3",Value4

I wanting 3 columns where Value2 and Value3 are in the same cell but with a
line return between them.

Is there anyway to do this?
 
J

Jim Aksel

During an import, I don't think it can be done. However, there may be a code
solution using VBA.

CSV files are purely text. So, what you are asking for is access to the
"Notes" field method and properties once you bring the data into Project. It
appears the only items visible to us on a task field for Notes would be
..Notes and .AppendNotes both of which only accept strings.

You may be able to write some ASCII to the input string as you append it. I
did some checking in the Object Browser for VBA and came up with this:

The Notes property does not accept characters with an ASCII value less than
32, except for the carriage return (ASCII 13) and linefeed (ASCII 10)
characters.

So, I think you may be stuck and will need to do it manually. Try reposting
to the Developer newsgroup and you may get some additional information. From
what I recall, I don't think Microsoft made much of the formating commands
available via VBA.


--
If this post was helpful, please consider rating it.

Jim Aksel, MVP

Check out my blog for more information:
http://www.msprojectblog.com
 
C

chazparks

I actually mean for â–“ to be a ASCII(10) in the CSV file. I just needed to
use a different character for posting here.
 
J

Jim Aksel

The following code writes the values "Line1" though "Line4" each separated by
a carriage return and a line feed for every task in a project. See if this
gets you started. The end result is a stack:
Line1
Line2
Line3
Line4

I include an original line to write Line1 & 2, then I append it in the next
line so you can see how it was done.

Public Sub PlayWithTaskNotes()
Dim tsk As Task
For Each tsk In ActiveProject.Tasks
tsk.Notes = "Line1" & vbCrLf & "line2"
tsk.AppendNotes (vbCrLf & "Line3" & vbCrLf & "Line4")
Next
End Sub

Should you have other questions, it may be better to post into the Developer
newsgroup as some of the vba guru gurus hang out there. We all read this
group too, you may get other responses "Over there"

If i understand correctly, I think you need to programatically open your CSV
file, hunt for your task Unique ID and read the strings you want into
separate variables. Then use the Notes and AppendNotes properties/methods to
create your notes on the desired tasks.

For additional info, you can reference tasks directly by their UniqueID:
activeproject.Tasks(i).Notes where "i" is the task unique ID that you have
divined by some method.


From the Object browser, the following values may be of interest:

vbCrLf (carriage return and line feed) = Chr(13)+Chr(10)
vbCr (carriage return) = Chr(13)
vbLf (Line feed) = Chr(10)
vbNewline (same as vbCrLf) is Chr(13) for MAC users
vbTab = Chr(9) not supported by .Notes
vbBack = Chr(8) not supported by .Notes
vbFormFeed (new page) = Chr(12) is note supported by Windows.
--
If this post was helpful, please consider rating it.

Jim Aksel, MVP

Check out my blog for more information:
http://www.msprojectblog.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top