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

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

Post by Graham May » Mon, 02 Nov 2009 17:26:11


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

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


StargateFan wrote:


 
 
 

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

Post by StargateFa » Mon, 02 Nov 2009 17:54:07


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. :oD






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>.

 
 
 

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

Post by StargateFa » Mon, 02 Nov 2009 19:06:38


On Sun, 1 Nov 2009 10:26:11 +0200, "Graham Mayor"




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!!