vasim
Member
I have got the following code from
http://excel.tips.net/T002668_Always_Open_at_100_Zoom.html
The code works fine on 2007 but throws an error in 2010 version,any reason or help.
[pre]
[/pre]
http://excel.tips.net/T002668_Always_Open_at_100_Zoom.html
The code works fine on 2007 but throws an error in 2010 version,any reason or help.
[pre]
Code:
Declare Function GetSystemMetrics32 Lib "user32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
Public Sub ScreenRes()
Dim lResWidth As Long
Dim lResHeight As Long
Dim sRes As String
lResWidth = GetSystemMetrics32(0)
lResHeight = GetSystemMetrics32(1)
sRes = lResWidth & "x" & lResHeight
Select Case sRes
Case Is = "800x600"
ActiveWindow.Zoom = 75
Case Is = "1024x768"
ActiveWindow.Zoom = 125
Case Else
ActiveWindow.Zoom = 100 'throws error
End Select
End Sub
Private Sub Workbook_Open()
ScreenRes
End Sub