Excel Export Hangs on Number in Categorized View

Good Day All,

I have a stand by Excel export that I had harvested out of the Sandbox and made my own with a couple tweaks. Today for the first time it is hanging and I cannot determine why.

It is hanging on the first row after the headers have been grabbed on the 4 column which is a number (ALWAYS).

The error message I am receiving is “Type Mismatch” on the following line of code:

“xlsheet.Cells(rows,cols).Value = Implode(NewVal, “;”)”

Again I have been using this export with minor variations since I started coding LotusScript so I have now idea why this particle set of views is causing such an issue.

Any pointers would be greatly appreciated…

Thank you,

Ken

Subject: Excel Export Hangs on Number in Categorized View

Hi Ken,

Can you confirm that NewVal is definitely always an array?

Try changing that line of your code to:

If IsArray(NewVal) then

xlsheet.Cells(rows,cols).Value = Implode(NewVal, “;”)

Else

xlsheet.Cells(rows,cols).Value = NewVal

End If

Emily

Subject: RE: Excel Export Hangs on Number in Categorized View

Thanks for the Suggestion Emily, but the Variant (NewVal) is always recognized as an Array, so I attempted to use IsNumeric in place but I am still getting the same result…

Subject: Excel Export Hangs on Number in Categorized View

Hi Ken,

First , can you try get hold og the document from which u r getting this error. Probably you have to us Script Debugger for the same. Can you check if the data type value of NewVal variable is correct.

Tom

Subject: RE: Excel Export Hangs on Number in Categorized View

The Document is available that the LS is hanging on.

The Type is Double when it is going through the debugger, which is normal for any number in this script. The Block of code surrounding the line is as follows:

For x=1 To maxcols

	xlsheet.Cells(rows,cols).Value = dataview.columns(x-1).title

	cols = cols + 1

Next



Set datadoc = dataview.getfirstdocument

Dim fitem As NotesItem

cols=1

rows=2

Do While Not (datadoc Is Nothing)

	For x=1 To maxcols 

		With dataview.Columns(x-1)

			If .isField Then

				NewVal = datadoc.GetItemValue(.itemname)

				xlsheet.Cells(rows,cols).Value = Implode(NewVal, ";")

			Elseif .isFormula Then

				If .formula="@IsExpandable" Then

					xlsheet.Cells(rows,cols).Value = ""

				Else

					xlsheet.Cells(rows,cols).Value = Evaluate(.formula,datadoc)

				End If

			End If

		End With

		cols=cols+1

	Next 

	xlApp.StatusBar = "Importing Notes Data - Document " 

	rows=rows+1

	cols=1

	Set datadoc = dataview.getnextdocument(datadoc) 

Loop

…

Subject: RE: Excel Export Hangs on Number in Categorized View

Hello,

Code looks to be fine. I think its todo with the valu with NewVal is returning . Also, Implode I think is a SubRoutine/Function which u r calling for the multiple values.

May be you get somethng there.

Tom