Using the Version Neutral PIA and Late Binding in VB.Net

Add-in Express™ Support Service
That's what is more important than anything else

Using the Version Neutral PIA and Late Binding in VB.Net
 
Daryl Foster




Posts: 25
Joined: 2008-01-11
Hi I am using the version neutral PIAs in an Addin for Word 2003 but I need to get the value of a property that doesn't exist in these PIAs. I know that I need to use late binding and InvokeMember to do this but I can't find an example of how to do it in VB.Net.

The property that I need is RecordCount from

WordApp().Application.ActiveDocument.MailMerge.DataSource

Could someone please give me an example or point me in the right direction so that I can find the value of this property?

Thanks.

Posted 01 May, 2008 03:31:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7230
Joined: 2004-07-05
Hi Daryl.

If you use VB.NET, you can call the property directly.

WordApp().Application.ActiveDocument.MailMerge.DataSource.RecordCount

Posted 01 May, 2008 12:36:13 Top
Daryl Foster




Posts: 25
Joined: 2008-01-11
Thanks Sergey,

I thought I could do that too, but when I do I get the following error:

'RecordCount' is not a member of 'Word.MailMergeDataSource'

Posted 01 May, 2008 20:49:09 Top
Sergey Grischenko


Add-in Express team


Posts: 7230
Joined: 2004-07-05
Hi Daryl.

Please try the following code:

Dim ds As Object = WordApp().Application.ActiveDocument.MailMerge.DataSource
Dim i As Integer

i = ds.RecordCount
Posted 02 May, 2008 08:31:34 Top