Error 4248 on Print Layout command hen opening Word ... ? [Word 2003, WinXP]

S

StargateFan

I found the following code on the web for my AutoExec so that even
html docts., which normally default to Web Layout, all default to
Print Layout, my sole preference in viewing files in Word (I never use
the other options):
--------------------------------------------------------------------------
Sub AutoExec()
ActiveWindow.View.Type = wdPrintView
End Sub
--------------------------------------------------------------------------

(Well, there's other code in the AutoExec but all the rest besides the
above has worked just fine for about a year now.)

But upon Word launch, the above wdPrintView line gets highlighted in
the vbe in yellow and appears with the following error:
--------------------------------------------------------------------------
Run-time error '4248':

This command is not available because no document is open.
--------------------------------------------------------------------------

When I press END or DEBUG, _then_ the document opens.

Is there a way to get the wdPrintView command to work to force Word to
open in PRINT LAYOUT without this error? It doesn't work in this case
by putting it in AutoNew since the PrintLayout mode seems to then work
only on blank docts we get when we go FILE > NEW.

I've got a script that sends a file and picture(s) in HTML text to a
Word document since it's the easiest to work with commandline-style
text and image dumping. However, despite it being a DOC file, Word
seems to sense it's html anyway for it always opens these docts in Web
Layout mode.

Also, despite one MVP advising someone else against setting their own
preferences by putting this type of code on Word startup, this is
strictly for me and my computer so that viewpoint is absolutely moot
in this particular case <g>.

---------

Secondly, pls, does anyone know what the commands for PRINT LAYOUT for
both items below?:

- Zoom - Page Width
- Zoom - Whole Page

I haven't decided which zoom will be best for this so it would be good
to know what both are ahead of time.

Thank you very much in advance. :eek:D






p.s., only in last couple of years have I realized what a great
WYSIWYG html editor Word is! And I had it all along without knowing
it <g>.



p.p.s., the initial code might be html and I may then edit in Word but
this is just a quick way to print out separate text and image files.
I collect research info as separate TXT/JPG since they are smallest
load on my hdd space (dealing with hundreds of files. DOC and even
PDF would be 10 times or more the size of the present load). I used
to open in IE but no editing easily possible. Word allows me
speed/better output. And since Word doct is used only for printing,
then deleted, no worries re non-compliant html code or anything, just
in case anyone had any concerns re that point <lol>.
 
S

StargateFan

Change the name to Sub AutoOpen()
See http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Ahhhh, now isn't that _marvellous_!

Thank you! Now that I know the 3 terms, I'll look them up and see
what each one actually does. I'm still rather new to these terms so
now it's time to find what they do exactly and save that information
to my tips folders.

So it's:

AutoExec
AutoNew
AutoOpen

Thanks!!
 

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