Minimize a Word doc created in an Excel for Mac macro

Bill Hamilton

Board Regular
Joined
Mar 30, 2004
Messages
95
I have an Excel macro that starts up Word and creates labels (the little 65/sheet variety). I'm using the standard method of starting Word (Set Wrd = GetObject(, "Word.application")) and the Word instance is immediately given the 'Wrd.Visible=False' treatment so the activity that takes place to populate the label doc is not shown to the user and runs much, much faster than it would do if the doc was visible.

All that works fine under Windows. However, I need to port this application to work under Excel (and Word) on a Mac but the 'Wrd.Visible=False' instruction does absolutely nothing: the Word doc remains visible and the the label-creation code takes ages because of all the screen updating that's taking place. I can watch each line of each label being written out. Label runs can go from 20 or so to over 10,000 so this is important.

I've tried using 'Wrd.Application.WindowState = wdWindowStateMinimize' and that is accepted under Windows but is flagged with 'Run-time error 4231: This command is not available' when run on the Mac. I'm using the enumeration value of 2 for the Minimize keyword.

Does anyone know how to make a Word doc go away while it's being updated when running under Excel for Mac? It's a bit of a showstopper for this application if it can't be done.

I'm using Office 2016 under Windows 10 and Office 2019 on a MacBook Pro under Catalina.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
If anyone's interested, I thought I'd just finish this by saying I've found the answser, after a lot of googling and experimenting.

Use Wrd.ActiveWindow.WindowState=xlMinimize after Activating the document object opened under Wrd..

Works a treat. Case closed.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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