
Declare Function GetSystemMetrics32 Lib "user32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
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 = 65
Case Is = "1024x768"
ActiveWindow.Zoom = 75
Case Is = "1152x864"
ActiveWindow.Zoom = 85
Case Is = "1280x768"
ActiveWindow.Zoom = 90
Case Is = "1280x1024"
ActiveWindow.Zoom = 100
Case Else
ActiveWindow.Zoom = 100
End Select
End Sub
|
'in un modulo metti questo
Declare Function GetSystemMetrics32 Lib "user32" _
Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
'all'apertura file
Private Sub Workbook_Open()
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 = 65
Case Is = "1024x768"
ActiveWindow.Zoom = 75
Case Is = "1152x864"
ActiveWindow.Zoom = 85
Case Is = "1280x768"
ActiveWindow.Zoom = 90
Case Is = "1280x1024"
ActiveWindow.Zoom = 100
Case Else
ActiveWindow.Zoom = 100
End Select
End Sub
---------------------------------------
ad ogni foglio
Private Sub Worksheet_Activate()
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 = 65
Case Is = "1024x768"
ActiveWindow.Zoom = 75
Case Is = "1152x864"
ActiveWindow.Zoom = 85
Case Is = "1280x768"
ActiveWindow.Zoom = 90
Case Is = "1280x1024"
ActiveWindow.Zoom = 100
Case Else
ActiveWindow.Zoom = 100
End Select
End Sub
|
Sub Zoom_Casa()
Dim ws As Worksheet, lngZoom As Long
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case "Foglio1": lngZoom = 80
Case "Foglio2": lngZoom = 85
Case "Foglio3": lngZoom = 105
End Select
Application.ScreenUpdating = False
With ws
.Select
ActiveWindow.Zoom = lngZoom
End With
Next ws
Sheets(1).Activate
Application.ScreenUpdating = True
End Sub
Sub Zoom_Uff()
Dim ws As Worksheet, lngZoom As Long
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case "Foglio1": lngZoom = 115
Case "Foglio2": lngZoom = 108
Case "Foglio3": lngZoom = 78
End Select
Application.ScreenUpdating = False
With ws
.Select
ActiveWindow.Zoom = lngZoom
End With
Next ws
Sheets(1).Activate
Application.ScreenUpdating = True
End Sub
|
