Converting code to support late binding
I am using the following code which makes use of early binding :
Code:
Dim oDoc As Microsoft.Office.Interop.Word.Document
oDoc = DirectCast(axFramerControl1.ActiveDocument, Microsoft.Office.Interop.Word.Document)
oDoc.ActiveWindow.Selection.WholeStory()
The problem is that I would like to dump my reference and use late binding instead.
Can anyone convert this please ?
Thanks in Advance
Re: Converting code to support late binding
Why on earth would you want to use late binding? I've never seen a convincing reason and all it does is slow down your program.
Aside from that, I'm trying to figure out what you're trying to accomplish as to how to apply late-binding. What's wrong with your above code? What isn't it doing for you?
Re: Converting code to support late binding
Well turn Option Strict Off and declare oDoc as Object.
I agree with Jenner though, late binding should be avoided whenever possible. In this case, it provides no advantage so it should not be used, since the only visible effect would be a performance reduction.