Finde Antworten, stelle Fragen und schließe dich mit unserer Community zusammen.

Startseite Forums Excel VBA Code Snippets Komplex Test

  • Komplex Test

    Posted by tom on 13. Dezember 2024 at 23:20

    
    

    Sub Workbook_Open()
    Call ScreenResolution
    With ActiveWindow
    .WindowState = xlNormal
    If lHsize < 2000 Then
    .Application.Width = 800
    .Application.Height = 800
    .Application.Left = 50
    .Application.Top = 50
    Else
    .Application.Width = 1024
    .Application.Height = 1024
    .Application.Left = 150
    .Application.Top = 150
    End If
    End With
    ActiveWindow.Zoom = 145
    End Sub

    Dieser Code muss in ein Modul.

    
    

    Public Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Public lHsize As Long, lVsize As Long
    Const SM_CXSCREEN = 0
    Const SM_CYSCREEN = 1
    Function ScreenResolution()
    ' lHsize = Breite des Bildschirms in Pixeln
    ' lVsize = Höhe des Bildschirms in Pixeln
    lHsize = GetSystemMetrics(SM_CXSCREEN)
    lVsize = GetSystemMetrics(SM_CYSCREEN)
    End Function
    • This discussion was modified 1 month aktiv. by  tom.
    • This discussion was modified 1 month aktiv. by  tom.
    • This discussion was modified 1 month aktiv. by  tom.
    tom replied 1 month aktiv. 1 Member · 2 Replies
  • 2 Replies
  • tom

    Administrator
    13. Dezember 2024 at 23:21

    Sub Workbook_Open()
    Call ScreenResolution
    With ActiveWindow
    .WindowState = xlNormal
    If lHsize < 2000 Then
    .Application.Width = 800
    .Application.Height = 800
    .Application.Left = 50
    .Application.Top = 50
    Else
    .Application.Width = 1024
    .Application.Height = 1024
    .Application.Left = 150
    .Application.Top = 150
    End If
    End With
    ActiveWindow.Zoom = 145
    End Sub

    • This reply was modified 1 month aktiv. by  tom.
    • This reply was modified 1 month aktiv. by  tom.
  • tom

    Administrator
    13. Dezember 2024 at 23:32

    Public Declare PtrSafe Function GetSystemMetrics Lib “user32” (ByVal nIndex As Long) As Long
    Public lHsize As Long, lVsize As Long
    Const SM_CXSCREEN = 0
    Const SM_CYSCREEN = 1
    Function ScreenResolution()
    ‘ lHsize = Breite des Bildschirms in Pixeln
    ‘ lVsize = Höhe des Bildschirms in Pixeln
    lHsize = GetSystemMetrics(SM_CXSCREEN)
    lVsize = GetSystemMetrics(SM_CYSCREEN)
    End Function

    • This reply was modified 1 month aktiv. by  tom.
    • This reply was modified 1 month aktiv. by  tom.

Log in to reply.