I have the following little script. It works, but when I look at the results in excel, each column has about 7-8 spaces before the data starts. I’ll try to illustrate (quotes/underscores are mine for clarity purposes only) … for column containing state it appears like this “________California” instead of just “California”
I’m always creating a brand new file in excel so I don’t know of any properties there that would affect this. Here is my script:
Sub Initialize
Open "C:\ExportTest\ExpTest40.CSV" For Output As #1
Dim ws As New notesuiworkspace
Set view=ws.currentview.view
Set doc=view.getfirstdocument
Do While Not(doc Is Nothing)
Print #1, doc.IssueNumber(0), "," , doc.State(0)
Set doc=view.getnextdocument(doc)
Loop
Close #1
That’s because your using the “+” (plus) operator for concatenation. Since this operator implies one of two different operations, it raises a type-mismatch error because one of the fields has a numeric value in it. Use the “&” (ampersand) operator, which is explicitly for concatenation. This avoids the type-checking issue altogether thus making your code a little more bullet-proof.dgg
The Cstr worked with the plus sign, but I can omit the Cstr completely if I use the &. But when I had them separated with a comma only, the leading spaces appeared for some reason. Live and learn!