Hello,
I have updated the question with the v declaration.
Sorry I have forgotten to add it.
Edit:
I had to change the hard disk to a copy of my co-worker and it works. No idea why. :(
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am trying to get coordinates of a bookmark item on a word document.
Dim w = wApp()
Dim doc = w.Documents.Open(DOCFileName, , True)
Dim v As Word.Window = doc.ActiveWindow
Dim izq As Int32, sup As Int32, ancho As Int32, largo As Int32
Dim r As Word.Range
doc.Application.Visible = True
r = doc.Bookmarks.Item("ANYOFIRMA").Range
Until here the variables apparently have values and no error popped up.
v.GetPoint(izq, sup, ancho, largo, r) -> This output the error: System.Runtime.InteropServices.COMException: 'El comando falló'
I am lost and I don't know what else to try.
Cheers
Hello,
I have updated the question with the v declaration.
Sorry I have forgotten to add it.
Edit:
I had to change the hard disk to a copy of my co-worker and it works. No idea why. :(
I could not reproduce the problem with my copy of Word.
Code snippet -
Dim wApp As Application
Dim d As Document
Dim b As Bookmark
Dim r As Range
Dim v As Window
Dim izq As Int32, sup As Int32, ancho As Int32, largo As Int32
wApp = New Application()
wApp.Visible = True
d = wApp.Documents.Open("C:\Users\RLWA32\Documents\BOOKTEST.docx")
b = d.Bookmarks("BOOKTEST")
v = d.ActiveWindow
r = b.Range
v.GetPoint(izq, sup, ancho, largo, r)
Variables in debugger -