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

Startseite Forums Excel VBA Code Snippets Excel in 1:1 Verhältnis öffnen

Tagged: 

  • Excel in 1:1 Verhältnis öffnen

    Posted by Excel Community on 6. September 2024 at 22:19

    Dieser Code muss unter “DieseArbeitsmappe”.


    [vba]

    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

    [/vba]


    Dieser Code muss in ein Modul.

    [vba]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[/vba]

    Excel Community replied 2 months, 2 weeks ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.