WD98: VBA Macro to Make Document Fill the Macintosh Screen (185507)



The information in this article applies to:

  • Microsoft Word 98 Macintosh Edition

This article was previously published under Q185507

SUMMARY

In Microsoft Word 98 Macintosh Edition, if you want a document or template to fill the screen when it is opened, a macro is needed. Microsoft Word 98 Macintosh Edition opens a document in a window smaller than the screen, even if you save the file in full screen state. The Visual Basic command
   ActiveWindow.WindowState = wdWindowStateMaximize
				
does not work properly on the Macintosh.

The Visual Basic for Applications macro in the "More Information" section of this article allows you to open a Word document or template to fill the screen automatically.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To maximize a window with an autoexec macro, you must get the macro to run after the window is available. This requires two macros. The following two macros allow Word to open and fill the screen with any number of toolbars active. The macro checks the resolution setting of the Macintosh system and adjusts the window accordingly.

NOTE: You must name the first macro AutoExec:
Sub AutoExec()
  ' Adjust the delay on the second macro with TimeValue.
  Application.OnTime when:=Now + TimeValue("00:00:03"), Name:="MadMax"
End Sub
				
NOTE: You must name the second macro MadMax:
Sub MadMax()
   With ActiveWindow
      If System.OperatingSystem = "Macintosh" Then
         horz = System.HorizontalResolution
         vert = System.VerticalResolution
         .Width = horz - 3
         .Height = vert - 85
      End If
   End With
   If CommandBars("Drawing").Visible = True Then
      CommandBars("Drawing").Visible = False
      CommandBars("Drawing").Visible = True
   End If
End Sub
				

Running the Macro Automatically

Naming the macro AutoExec causes a new document to fill the screen when Word is started.

For additional information about auto macros in Word, please see the following article in the Microsoft Knowledge Base:

70991 WD97: Auto Macros in Word

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

163435 VBA: Programming Resources for Visual Basic for Applications


Modification Type:MajorLast Reviewed:6/18/2005
Keywords:kbconversion kbconvert kbhowto kbmacroexample KB185507