Opening Word maximized

philR

Active Member
Joined
Feb 25, 2002
Messages
257
OK, I have done the hard bit, now I am stuck on the easy bit! Using this code to open a word document, But I would like it to open with Word maximized, and the document at 100% zoom. Should be easy I know...

Dim myWord As Object
Set myWord = CreateObject("Word.Application")
myWord.Visible = True
myWord.Documents.Open FileName:="C:IntTrainTemplate.doc", ReadOnly:=True
With myWord
..do some stuff..
End With

Thanks
This message was edited by philR on 2002-10-02 04:58
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
On 2002-10-02 04:57, philR wrote:
OK, I have done the hard bit, now I am stuck on the easy bit! Using this code to open a word document, But I would like it to open with Word maximized, and the document at 100% zoom. Should be easy I know...

Dim myWord As Object
Set myWord = CreateObject("Word.Application")
myWord.Visible = True
myWord.Documents.Open FileName:="C:IntTrainTemplate.doc", ReadOnly:=True
With myWord
..do some stuff..
End With

Thanks
This message was edited by philR on 2002-10-02 04:58

Try:

Sub Word()
Dim myWord As Object

Set myWord = CreateObject("Word.Application")
myWord.Visible = True
myWord.Documents.Open FileName:="C:IntTrainTemplate.doc", ReadOnly:=True
With myWord
.Application.WindowState = wdWindowStateMaximize
.ActiveWindow.ActivePane.View.Zoom.Percentage = 100
End With

Set myWord = Nothing

End Sub

Note: you will need to Set myWord = Nothing so Excel no longer has anything to do with Word. otherwise when you close Word it will still be memory.
 
Upvote 0
Thanks.
The zoom thing is working, but the document still opens with Word taking up about 1/2 the screen. (I had already tried your idea) any others?
 
Upvote 0
On 2002-10-02 05:57, philR wrote:
Thanks.
The zoom thing is working, but the document still opens with Word taking up about 1/2 the screen. (I had already tried your idea) any others?

the line:

.Application.WindowState = wdWindowStateMaximize

is working fine for me, if I comment it out I get a half screen as you describe?
 
Upvote 0
Wonder if it anything to do with it being a password protected document, which I am opening as read-only? Surely that shouldn't affect the application settings? Me puzzled.
 
Upvote 0
On 2002-10-02 06:23, philR wrote:
Wonder if it anything to do with it being a password protected document, which I am opening as read-only? Surely that shouldn't affect the application settings? Me puzzled.

Could be??

Try:

myWord.Documents.Open FileName:="C:IntTrainTemplate.doc", Passworddocument:="YourPassword", ReadOnly:=True
 
Upvote 0
On 2002-10-02 06:44, philR wrote:
Still nothing.

I really can't think of anything,
have you tried running it without loading the document, to see if it work like that?
 
Upvote 0
Ha! Solved it. For some reason, it wouldn't accept wdwindowstatemaximize, but it works if I put 1 instead. Maybe it is because excel doesn't recognise it? I am using excel 97 - maybe that makes a difference. Anyway, thanks for your patience and help.

PhilR
 
Upvote 0
On 2002-10-02 07:59, philR wrote:
Ha! Solved it. For some reason, it wouldn't accept wdwindowstatemaximize, but it works if I put 1 instead. Maybe it is because excel doesn't recognise it? I am using excel 97 - maybe that makes a difference. Anyway, thanks for your patience and help.

PhilR

A damned fool mistake for me to make,
only recently I was told to pass the value NOT the name, as the application will always pick up the value.

A*se! sorry, it was a gem of information i thought I'd remember (and should have).
oh well, glad to hear it works.
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,954
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top