goto in Word

  • Thread starter Philipp Schramek
  • Start date
P

Philipp Schramek

Hi
I want to open a word file and go to a specific bookmark in word.
Therefore I wrote the code you see below.

....
Private Sub CommandButton1_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open("S:\Folder\File.doc")
wrdDoc.GoTo What:=wdGoToBookmark, Name:="SomeText"
End Sub
....

My problem is that it works as far as it opens the file but it does not
go to the position I told to, or at least it does not scroll there. In
Word-VBA a "scroll = true" option is not given like in Excel-VBA.

Additionally I would like to check whether the file is already open
before opening it again. I could not find out yet how to check whether a
file is already open or not.

Does anyone have some advise.
Thanks Philipp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top