|
-
Apr 5th, 2004, 12:02 AM
#1
Thread Starter
Junior Member
-
Apr 5th, 2004, 01:58 AM
#2
Member
I think this is because you're in the wrong view when you access the word document, you can't get to the bookmark unless you're in Header/Footer view if the bookmark is in the Header/Footer.
The code you get if you record a macro in Word is this:
Code:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.TypeText Text:="vxzcv"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
/Nisse
-
Apr 5th, 2004, 02:12 AM
#3
Thread Starter
Junior Member
sory...
i'm still dont understand how to use it...
can u elaborate it more ?
or can u give the example?
where should i put the code?
this is totally different than usual.....
-
Apr 5th, 2004, 02:28 AM
#4
Member
Ok, had to try it out, so I wrote a few lines. This worked for me:
Code:
Dim wdApp As New Word.Application
Dim wdDoc As Word.Document
wdDoc = wdApp.Documents.Open("C:\Test.doc")
wdDoc.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekPrimaryHeader
wdDoc.Bookmarks("Test").Select()
wdApp.Selection.TypeText("Hallo world!")
wdDoc.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekMainDocument
/Nisse
-
Apr 6th, 2004, 08:12 PM
#5
Thread Starter
Junior Member
-
Apr 7th, 2004, 01:46 AM
#6
Thread Starter
Junior Member
-
Apr 7th, 2004, 04:31 AM
#7
Member
It does not exist.... in that view....
/Nisse
-
Apr 7th, 2004, 04:44 AM
#8
Thread Starter
Junior Member
_______________________________________________
so,,,
in wat view it does exist???
arghh...this thing can make my life short...
_______________________________________________
-
Apr 7th, 2004, 08:21 AM
#9
Member
as I stated before:
wdSeekCurrentPageHeader
You mentioned you created a Application object with CreateObject. To be able to get to the diffent view and to be able to select bookmark you should create a document object in the application, then you should be able to do what I presented in earlier replies to this post.
/Nisse
-
Apr 7th, 2004, 09:29 AM
#10
Member
If you had an application object named x then create a documentobject d and give it your activedocument in the application.
Code:
c = x.ActiveDocument
then try something like I posted before:
Code:
d.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekPrimaryHeader
d.Bookmarks("Test").Select()
x.Selection.TypeText("Hallo world!")
d.ActiveWindow.View.SeekView = Word.WdSeekView.wdSeekMainDocument
/Nisse
-
Apr 9th, 2004, 01:08 AM
#11
Thread Starter
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|