Reputation: 7922
I'm trying to call this code in VB.NET with "option strict on":
Dim application As word.Application = New word.Application
application.WordBasic.DisableAutoMacros(1)
The WordBasic object is dynamic, there is no type library available.
Now the compiler will complain, because late binding is not allowed.
Is there a workaround?
Upvotes: 0
Views: 756
Reputation: 942348
Yes, that got borken in vb.net since VS2008, a victim of the Linq and Option Infer powerhouses.
Making it early bound is too tricky, there are too many versions of VBA floating around. Notable is that I couldn't get Reflection working, which would normally be the early bound way to do late binding :) Best thing to do is put this code in a separate source code file so you can compile that with Option Strict Off in effect.
Upvotes: 1