Reading layout view

B

Bryan Dickerson

Is the View of a document something that is stored in the local profile or
within the document? I.e. is it something that I can set programmatically
so that when a customized document is created and subsequently opened by the
user or an external recipient, it always shows in a certain view?
 
G

Greg

Bryan,

Try something like:

Sub Document_Open()
With ActiveWindow.View
.Type = wdNormalView (change to view you want)
End With
End Sub
 
B

Bryan Dickerson

In my original post, I failed to indicate that my customization routine was
a VB6 routine. So does this indicate that I would have to embed this tidbit
of code in the document?
 
B

Bryan Dickerson

Hello?? Anyone out there?

Bryan Dickerson said:
In my original post, I failed to indicate that my customization routine
was a VB6 routine. So does this indicate that I would have to embed this
tidbit of code in the document?
 
G

Greg Maxey

Bryan,

I didn't answer because to tell yo the truth I don't know what the term VB6
or VB.NET means. I just open Word, press Alt+F11. Whatever it is that
opens, that is what I am using. The code I posted is part of the document.

Sorry I can't be more helpful.
 
B

Bryan Dickerson

Ok, forget the part about VB6 or VB.Net (I don't know that I ever mentioned
that, but nonetheless...). If you were going to write some code to save a
document so that it ALWAYS opened in the Print View/Mode/Layout, what would
that code look like??
 
G

Greg

I would do it like this:

Sub Document_Open()
With ActiveWindow.View
.Type = wdPrintView
.Zoom.PageFit = wdPageFitBestFit
End With
End Sub

Stored in Project(yourdocument)
 
B

Bryan Dickerson

Ok. But I was told by a co-worker that the 'default view' of a document can
be saved with the document (maybe this person was wrong, but I'll give him
the benefit of the doubt, for now). So if I wanted to write a routine, for
example, to run on a template document, fill in some information from an
external source (like a database), and save the document out as a
customized, custom-named document with the default view being the Print
View, how would that code that defines the default view look? Or would you
always put this code snippet (that you suggested below) in the document so
that when the document opens, it opens in Print View?
 
B

Bryan Dickerson

I just found this in the Word 2003 Help files:

Note You can't set a default for all documents that you view in Word,
because the view setting is stored with each individual document as a
document property. You can save your document in the view with which you
want it to open. Documents that you receive from others will open with the
view in which they were previously saved.

So what piece of code will change this property when the document is edited
and saved?
 
G

Greg Maxey

Bryan,

I have told you what code to put in the document if you want it to open in
Printview. If you want a second opinion then by all means feel free to keep
asking the question. I am bowing out of this thread.
 
B

Bryan Dickerson

Don't worry as it may have ultimately helped me anyway. The FAQ that you
referenced caused me to realize what was causing the problem--the option in
the Tools, Options dialog box. So I recorded a macro while I set the Tools,
Options, General Tab, and unchecked the "Allow Reading Mode" box. Then I
checked out the code that the macro recorder generated and that proved to be
the solution. Right before my VB routine Saves the document and closes
Word, I issue the following statement:

Word.ActiveDocument.Application.Options.AllowReadingMode = False

.... and voila! No more Reading layout! Thanx for your help!!
 

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