#6478
Anonymous

Hi, thanks for your help

I tried to use the WrapText method in the procedure and when I call the procedure (codes below), but it doesn’t seem to work for me. Can you tell me if I’ve put the line of code in the wrong place or what seems to be the problem? I appreciate your helps.

private sub WriteIntoCell(iNewWorkBook, iRow, aSubject, aMessageID, aStartDate, aDueDate, aBodyText)

iDuration = DateDiff(“n”, aStartDate, aDueDate)

iNewWorkBook.ActiveSheet.Cells(iRow, 6).WrapText = True

with iNewWorkBook.ActiveSheet
.Cells(iRow, 1).Value = aSubject
.Cells(iRow, 2).Value = aMessageID
.Cells(iRow, 3).Value = aStartDate
.Cells(iRow, 4).Value = aDueDate
.Cells(iRow, 5).Value = iDuration
.Cells(iRow,6).Value = aBodyText (ERROR MESSAGE ON THIS LINE: UNKNOW RUNTIME ERROR)
end with

iTotalDuration = iTotalDuration + iDuration
iRow = iRow + 1
end sub

private sub PublishIntoMSExcel(iTotalItems, iMessagesList)

dim iNewWorkBook

iRow = 5

iExcel.visible = TRUE

with iStatusDlg
.Title = “Writing into excel…”
.ProgressRange = iTotalItems
.show
end with

Set iNewWorkBook = iExcel.WorkBooks.Add

‘ Loop through the messages list and extract the message object
for x = 1 to iTotalItems
set iMsg = iMessagesList.Item(x)

if not iMsg is nothing then
MsgBox(iMsg.Subject & ” – ” & iMsg.MessageID & ” – ” & iMsg.BodyText)

call WriteIntoCell(iNewWorkBook, iRow, iMsg.Subject, iMsg.MessageID, iMsg.StartDate, iMsg.DueDate, iMsg.BodyText)

With iNewWorkBook.ActiveSheet
.Cells(iRow,6).WrapText = True
End With
iStatusDlg.statustext = “Subject: ” & iMsg.Subject

end if

iStatusDlg.progressposition = x
next