Using the code pasted i am outputting documents to MS Word, the problem I’m having is all the tables that list document budget information are sent to the bottom of the document rather than in line with the other information. So if i have twelve notes documents selected they are output to one word doc and there are twelve budget tables at the bottom, they should be with their respective document information, can anyone see the problem?
Sub Initialize
Dim workspace As New notesuiworkspace
Dim session As New notessession
Dim Db As notesDatabase
Dim collection As notesdocumentcollection
Dim doc As notesDocument, uidoc As notesuidocument
Dim uiview As notesuiview
Dim rtitem As Variant
Dim TestItem As notesitem
Dim wordapp As Variant
Dim vValue As Variant
Dim i As Integer, imgCounter As Integer
Dim pDescription As String
Dim sValidated As String
Dim ImgDoc As notesDocument
Dim ImgView As notesView
Dim ActivityView As notesView
Dim ActivityDc As NotesDocumentCollection, ActivityDoc As notesDocument
Set uiview = workspace.currentview
Set db = session.CurrentDatabase
Set wordapp = createObject( “word.Application” )
wordapp.Visible = False
Set WordDocument = WordApp.Documents.Add()
TCounter = 0
Set collection = db.UnprocessedDocuments
For i = 1 To collection.count
TCounter = TCounter +1
Set Doc = collection.getnthdocument(i)
wordapp.Selection.Font.Size = 14
wordapp.Selection.Font.Name = “Helvetica”
wordApp.Selection.ParagraphFormat.Alignment = 0
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.Font.Underline = True
wordapp.Selection.Font.Bold = True
wordapp.Selection.TypeText(doc.PrgTitle(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(doc.PrjTitle(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordApp.Selection.ParagraphFormat.Alignment = 0
wordapp.Selection.Font.Size = 12
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.Font.Bold = True
wordapp.Selection.TypeText(“Brief Description:”)
wordapp.Selection.TypeParagraph
wordapp.Selection.Font.Bold =False
wordapp.Selection.Font.Underline = False
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & doc.PrjDesc(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.Font.Underline = True
wordapp.Selection.Font.Bold = True
wordapp.Selection.TypeText(“Detailed Description:”)
wordapp.Selection.TypeParagraph
wordapp.Selection.Font.Bold =False
wordapp.Selection.Font.Underline = False
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & doc.DetailedDesc(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.Font.Size = 14
wordapp.Selection.Font.Underline = True
wordapp.Selection.Font.Bold = False
wordapp.Selection.TypeText(“Financial Table”)
wordapp.Selection.Font.Underline = False
wordapp.Selection.Font.Size = 10
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
Set range = WordApp.Selection.Range
Set table = WordDocument.Tables.Add(range,6,5)
table.Cell(1, 1).Range.InsertAfter (“”)
table.Cell(1, 2).Range.InsertAfter (“Internal”)
table.Cell(1, 3).Range.InsertAfter (“External”)
table.Cell(1, 4).Range.InsertAfter (“Project Budget”)
table.Cell(1, 5).Range.InsertAfter (“Variance”)
table.Cell(2, 1).Range.InsertAfter (“O&M”)
table.Cell(3, 1).Range.InsertAfter (“Salary”)
table.Cell(4, 1).Range.InsertAfter (“FTE(Day)”)
table.Cell(5, 1).Range.InsertAfter (“G&C”)
table.Cell(2, 2).Range.InsertAfter (Format(doc.Int_OM(0),“Currency”))
table.Cell(3, 2).Range.InsertAfter (Format(doc.Int_Sal(0),“Currency”))
table.Cell(4, 2).Range.InsertAfter (doc.Int_FTE(0))
table.Cell(5, 2).Range.InsertAfter (Format(doc.Int_GC(0),“Currency”))
table.Cell(2, 3).Range.InsertAfter (Format(doc.Ext_OM(0),“Currency”))
table.Cell(3, 3).Range.InsertAfter (Format(doc.Ext_Sal(0),“Currency”))
table.Cell(4, 3).Range.InsertAfter (doc.Ext_FTE(0))
table.Cell(5, 3).Range.InsertAfter (Format(doc.Ext_GC(0),“Currency”))
table.Cell(2, 4).Range.InsertAfter (Format(doc.OM_Budget(0),“Currency”))
table.Cell(3, 4).Range.InsertAfter (Format(doc.Sal_Budget(0),“Currency”))
table.Cell(4, 4).Range.InsertAfter (doc.FTE_Budget(0))
table.Cell(5, 4).Range.InsertAfter (Format(doc.GC_Budget(0),“Currency”))
table.Cell(2, 5).Range.InsertAfter (“N/A”)
table.Cell(3, 5).Range.InsertAfter (“N/A”)
table.Cell(4, 5).Range.InsertAfter (Format(doc.FTE_Variance(0), “Currency”))
table.Cell(5, 5).Range.InsertAfter (“N/A”)
'WordApp.Selection.MoveDown
wordApp.Selection.Insertbreak
Set ActivityView = db.getView(“ActivityLookup”)
Set ActivityDc = ActivityView.getAlldocumentsbykey(doc.universalid)
If ActivityDc.count > 0 Then
wordapp.Selection.Font.Size = 14
wordapp.Selection.Font.Underline = True
wordapp.Selection.Font.Bold = True
wordapp.Selection.TypeText(“Activities”)
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
For a = 1 To ActivityDc.count
Set ActivityDoc = ActivityDc.getnthdocument(a)
wordapp.Selection.Font.Size = 12
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.Font.Underline = False
wordapp.Selection.Font.Bold = True
wordapp.Selection.TypeText(" Activity:")
wordapp.Selection.Font.Bold =False
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & ActivityDoc.Activity1(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Deliverable:”)
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & ActivityDoc.Deliverable1(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Rational / Defence:”)
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText( " " & ActivityDoc.Rational1(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Approval Status:”)
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & ActivityDoc.APStatus(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Activity Status:”)
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & ActivityDoc.Status(0))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Target Date:”)
wordapp.Selection.Font.ColorIndex = 1
If Not ActivityDoc.Date1(0) = “” Then
wordapp.Selection.TypeText(" " & Str(ActivityDoc.Date1(0)))
End If
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“FTE (Day):”)
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & Str(ActivityDoc.FTE(0)))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Budget:”)
wordapp.Selection.Font.ColorIndex = 1
If Isnumeric(ActivityDoc.Budget(0)) Then
wordapp.Selection.TypeText(" " & Str(ActivityDoc.Budget(0)))
End If
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Expenditures:”)
wordapp.Selection.Font.ColorIndex = 1
wordapp.Selection.TypeText(" " & Str(ActivityDoc.Allocated(0)))
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeText(“Variance:”)
wordapp.Selection.Font.ColorIndex = 1
If Isnumeric(ActivityDoc.Budget(0)) Then
wordapp.Selection.TypeText(" " & Str(ActivityDoc.Varian(0)))
End If
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
wordapp.Selection.TypeParagraph
Next
End If
Next i
wordapp.Visible = True
End Sub