View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Pausert of Nikkeldepaiin Pausert of Nikkeldepaiin is offline
external usenet poster
 
Posts: 10
Default Why Won't This Macro Work?

The following macro is installed in "This Workbook." All it needs to do is
identify the user's OS. If the OS is a Mac, the window maximizes and positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it should
position the window similarly, but then also cycle through each sheet and set
the font characteristics as shown. The macro works fine when I just run it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but again,
on a PC, nothing happens at all. In particular, I really need the font to set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can get it
to work, my ultimate plan is to modify the Mac part to rescale the font to
10, but that's assuming I can get the rest of it to go in the first place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub