I have an existing Word session running
A word document is open – DocumentOne
I would like to obtain and set a variable to DocumentOne
A second document is opened – DocumentTwo
I would like to obtain and set a variable to DocumentTwo active Document name
Select and activate DocumentOne
Edit DocumentOne
Select and activate DocumentTwo
Edit DocumentTwo
Select and activate DocumentOne
Do until end…
I have working code in VBA. However vb.net fails, and it maybe due to my declarations.
I’ve searched the net and some examples declare a new instance of Word. However I’m using the current open Word session/Instance.
This is my working VBA code.
Dim DocOne As Document
Dim DocTwo As Document
Dim strDocOne As String
dim
Set DocOne = ActiveDocument
x = ActiveDocument.Sections.Count
strDocOne = ActiveDocument.ActiveWindow.Caption
MsgBox (ActiveDocument.ActiveWindow.Caption)
MsgBox (strDocOne)
‘File Open second doc
Set DocTwo = ActiveDocument
Windows(strDocOne).Activate
ActiveDocument.Sections(j).Range.Select
Selection.Copy
Vb.net code Fail here…
Dim DocOne As Microsoft.Office.Tools.Word.Document
Dim DocTwo As Microsoft.Office.Interop.Word.Document
Perhaps I’m not correctly declaring. any suggestions would be greatly appreciated.
Many thanks in advance
--dd