ผมมีแต่ตัวอย่าง syntax นะครับ อาจจะไม่ครบลองเอาไป apply ดูครับ
Set oColl = view.GetAllDocumentsByKey (Key , True)
If oColl.Count < 1 Then
Print | No Document found with key: | & key
Exit Sub
End If
Set wordobj = CreateObject ("Word.Application")
' open document and show application
wordobj.Documents.Add
wordobj.Visible = False
Amount = 0
For i = 1 To 31
sData = Cstr(i) + "/" + docApp.DLG_monthYear(0)
Dim dtAmount As New NotesDateTime( sData )
If Not Trim(dtAmount.DateOnly) = "" Then
Amount = Amount + 1
End If
Next i
wordobj.ActiveDocument.Tables.Add wordobj.Selection.Range, (Amount *2), 1, wdWord9TableBehavior, wdAutoFitFixed
For i = 1 To Amount
bFlag = True
sData = Cstr(i) + "/" + docApp.DLG_monthYear(0)
wordobj.Selection.TypeText Cstr(i) + "/" + docApp.DLG_monthYear(0) & ", " & setWeekday(sData)
Set doc = ocoll.GetNthDocument ( 1 )
vIndex = Evaluate(|@If ( @Member (@Right("0| + Cstr(i) + |/" +@Text (month);5) ; @Explode(CF_HOLIDAY;",")) ; @true; @false);|,doc)
If Weekday(sData) = 1 Or Weekday(sData) = 7 Or vIndex(0) Then
wordobj.Selection.Shading.BackgroundPatternColor = 49407
End If
wordobj.Selection.MoveRight wdCell
wordobj.Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
wordobj.Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
For k = 1 To ocoll.Count
Set doc = ocoll.GetNthDocument ( k% )
sHours = doc.GetItemValue ("day_" + Cstr(i))(0)
If Not sHours = "" Then
bFlag = False
wordobj.Selection.Font.Bold = wdToggle
sChoose = getChoose(doc.GetItemValue ("choose_day_" + Cstr(i))(0))
sChoose = sChoose & " - " & doc.customer(0) & " - " & doc.activity(0)
wordobj.Selection.TypeText sChoose
wordobj.Selection.TypeParagraph
wordobj.Selection.TypeText "Hours: " & sHours
wordobj.Selection.Font.Bold = wdToggle
wordobj.Selection.TypeParagraph
Forall v In doc.GetItemValue ("comment_day_" + Cstr(i))
wordobj.Selection.TypeText v
End Forall
If Not i = Amount Then
wordobj.Selection.TypeParagraph
wordobj.Selection.TypeParagraph
End If
End If
Next k
If Not i = Amount Then
If bFlag Then
wordobj.Selection.TypeParagraph
wordobj.Selection.TypeParagraph
End If
wordobj.Selection.MoveRight wdCell
End If
Print "Exporting MS - Word: " + sData
Next i
wordobj.Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
wordobj.Selection.HomeKey wdStory
wordobj.Visible = True
wordobj.Activate
:yellow_cool.gif:
[quote]ต้องการ Export Viewไปเป็นเอกสาร Word นะครับทำได้มั้ยครับ
ถ้าทำได้ทำยังไงครับผม
ขอบขอบคุณล่วงหน้าครับ[/quote] |