Bookmarks in Footer filled from Access but doc NOT in PRINTVIEW ?

G

Guest

With the following commands Bookmarks are filled out in the footer of a word
doc from within access
but the document is shown in normal view.
I want it shown in Print View but even with the following code WORD keeps
Normal View ?
What is the solution ?
Thanks


Set oApp = CreateObject("Word.Application")
With oApp

.Documents.Open (strInputFile)
.ActiveDocument.Bookmarks("InvName").select
.Selection.Text = "test naar bookmark in footer"
.ActiveDocument.Bookmarks("InvNameBody").select
.Selection.Text = "test maar dan naar bookmark in bidy"

End With

With ActiveWindow.View
.Type = wdPrintView 'select page/print layout view
' .Zoom.Percentage = 100 'set the display zoom to 100%
' .FieldShading = wdFieldShadingWhenSelected 'set the field shading
preference
' .ShowFieldCodes = False 'turn off field code display
'.DisplayPageBoundaries = True 'Turn on white space between pages
'End With


oApp.Visible = True
 
G

Guest

Thanks Alex.
However I believe I interpreted the problem maybe wrongly.
The document opens all right; the boookmark has been replaced;

HOWEVER at that point the document is displayed and the cursor is positioned
at the replaced bookmark (showing the current date) which is all right.
But then the footer has been opened and remains open.

1) I want to close the footer section entirely and show the document in
print view.
But I don't know how......
2) When i manually close the footer section from within word, the document
still stays in normal view or outline view....It seems to ingore my printview
command !

I am totally lost here...as I have been searchin the internet for a solution
for hours but can't find a clue to solve it.

here's the code.
With oApp
.Documents.Open (strInputFile)
With oApp.ActiveWindow.View = wdPrintView
End With
If .ActiveDocument.Bookmarks.Exists("ORDefaultORReferBottom") = True
Then
.ActiveDocument.Bookmarks("ORDefaultORReferBottom").select
.Selection.Text = Now()
End If
With oApp.ActiveWindow.View = wdPrintView
End With
End With
 
A

Alex Dybenko

ok, i see
i think the best way to find this - while your proc stops - start recording
macro in word, make document looking whatever you like and then see what
code word generated. remeber i made the same once, but do not have my code
around
 

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