A
Allov
Hi,
We started using the Office Object Library, more specificaly the Word Object
Library with Office 2007 and VB.Net.
We'd like some pointers on some issues we're trying to figure out.
- Using the Mail Merge, is it possible to get an object of the newly created
document using this code? :
Me.Document.Activate()
Me.Document.MailMerge.MainDocumentType =
Word.WdMailMergeMainDocType.wdFormLetters
Me.Document.MailMerge.OpenDataSource(odcFile,
Word.WdOpenFormat.wdOpenFormatAuto, False, False, False, False, "", "",
False, "", "", cnnString, sql, "", False,
Word.WdMergeSubType.wdMergeSubTypeOther)
Me.Document.MailMerge.DataSource.FirstRecord =
Word.WdMailMergeDefaultRecord.wdDefaultFirstRecord
Me.Document.MailMerge.DataSource.LastRecord =
Word.WdMailMergeDefaultRecord.wdDefaultLastRecord
Me.Document.MailMerge.Destination =
Word.WdMailMergeDestination.wdSendToNewDocument
Me.Document.MailMerge.Execute(False)
In fact, what's going on right now is that it sends the mail merge to a new
document but we don't really know how to get this new document's object
reference to save it or do something with it.
- Is it possible to create one document per entry?
What we're trying to do is to create a PDF file per entry so we can send it
as an attachment by email. This is something we'd like to link with the first
question since we're already able to save as a PDF file using the SaveAsPDF
patch.
- Is there a way to somehow send a DataSet as a DataSource?
Some background: We checked the process of creating a Mail Merge as an End
User (using word exclusively). However, the only way to create the Mail Merge
template (to get a list of fields) is to plug in a valid DataSource (SQL
Server, Access, Office Address List, etc.)
Is there a way to give a dummy DataSource to the Mail Merge so our customers
don't have directly access to the DB data? Just like a Crystal Report or
Reporting Services report where you just give in some data structure
template. This way, customers won't need us to create formatted mail and will
have to fill in the fields.
However, data could come from the database once executed by code. In fact,
it's preferred.
Thanks a lot!
We started using the Office Object Library, more specificaly the Word Object
Library with Office 2007 and VB.Net.
We'd like some pointers on some issues we're trying to figure out.
- Using the Mail Merge, is it possible to get an object of the newly created
document using this code? :
Me.Document.Activate()
Me.Document.MailMerge.MainDocumentType =
Word.WdMailMergeMainDocType.wdFormLetters
Me.Document.MailMerge.OpenDataSource(odcFile,
Word.WdOpenFormat.wdOpenFormatAuto, False, False, False, False, "", "",
False, "", "", cnnString, sql, "", False,
Word.WdMergeSubType.wdMergeSubTypeOther)
Me.Document.MailMerge.DataSource.FirstRecord =
Word.WdMailMergeDefaultRecord.wdDefaultFirstRecord
Me.Document.MailMerge.DataSource.LastRecord =
Word.WdMailMergeDefaultRecord.wdDefaultLastRecord
Me.Document.MailMerge.Destination =
Word.WdMailMergeDestination.wdSendToNewDocument
Me.Document.MailMerge.Execute(False)
In fact, what's going on right now is that it sends the mail merge to a new
document but we don't really know how to get this new document's object
reference to save it or do something with it.
- Is it possible to create one document per entry?
What we're trying to do is to create a PDF file per entry so we can send it
as an attachment by email. This is something we'd like to link with the first
question since we're already able to save as a PDF file using the SaveAsPDF
patch.
- Is there a way to somehow send a DataSet as a DataSource?
Some background: We checked the process of creating a Mail Merge as an End
User (using word exclusively). However, the only way to create the Mail Merge
template (to get a list of fields) is to plug in a valid DataSource (SQL
Server, Access, Office Address List, etc.)
Is there a way to give a dummy DataSource to the Mail Merge so our customers
don't have directly access to the DB data? Just like a Crystal Report or
Reporting Services report where you just give in some data structure
template. This way, customers won't need us to create formatted mail and will
have to fill in the fields.
However, data could come from the database once executed by code. In fact,
it's preferred.
Thanks a lot!