Does anyone know how to export an embedded view to Microsoft Word?
I want to be able to create a report from a Notes document (client only) in Microsoft Word. I need to be able to take the Client mailing name and address information from the Notes document and also pull all of the documents in the embedded view and format the documents that were in the embedded view into a table in MS Word.
Does anyone know how to do this? If you know of a good article that deals with this or you have code that does all or part of what I am looking for I would appreciate it.
Thanks,
E
Subject: Exporting Embedded View
When I think of exporting a view I automatically think Excel (spreadsheet) and not word.
There is not ‘simple’ way of exporting an embedded view short of writing the code in LS yourself.
And there is not LS equivalent of @command([fileexport]) so you may have to use OLE.
heres an example:
'EXPORT TO EXCEL
Set view = db.GetView ("myView")
Dim objApp As Variant
Dim worksheet As Variant
Dim row As Integer
Dim col As Integer
Dim entrycoll As notesViewEntryCollection
Set entryColl=view.allentries
exportpath$ = "c:\temp"
exportfilename$ = "export.xls"
exportfilename$ = Inputbox$("Please specify file name for Export to Excel.:", "Export to c:\temp", exportfilename$)
exportpath$ = exportpath$ & "\" & exportfilename$
If exportpath$ = "" Then
Exit Sub
End If
doc.xlsFileName = exportfilename$
col=1
Set objApp=createObject("Excel.Application")
Set worksheet=objApp.workbooks.add
'create headings
Forall c In view.columns
objApp.cells(1, col).value=c.title
col=col+1
End Forall
Print "Please wait while records are being exported (this can takes a few minutes) . . ."
'begin adding data from entries
For row=1 To entryColl.count
Set entry=entryColl.getnthEntry(row)
Print "Creating Excel File Row " & Cstr(row) & " of " & Cstr(entryColl.count)
For col=0 To Ubound(entry.columnvalues)
objApp.cells(row+1, col+1).value=entry.columnvalues(col)
objApp.cells(row+1, col+1).select
Next
'Print "exporting document number " & Cstr(row) & " of " & Cstr(entryColl.count)
objApp.Columns("A:Z").AutoFit
objApp.DisplayAlerts = False 'Avoid SaVE AS dialog from appearing
worksheet.SaveAs(exportpath$)
Print "Export complete! File Exported to: " & "c:\temp\" & exportfilename$
Call worksheet.close
Call objApp.Quit
HTH
ST
Subject: RE: Exporting Embedded View
Stephen,
My first thought when I read your post was, this is not what I want. After thinking about it, it is exactly what I need.
I can take your example one step further and put in the formatting that I need.
Thanks. I think you just solved my problem.
E