Excel (VBA): Bildschirmauflösung auslesen

2010-02-20 von Mario

Für ein VBA-Script habe ich die aktuelle Bildschirmauflösung benötigt. Die implementierte Funktion sieht wie folgt aus.

Option Explicit
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1

Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Public Function ScreenResolution()

    Dim x As Integer
    Dim y As Integer

    x = GetSystemMetrics(SM_CXSCREEN)
    y = GetSystemMetrics(SM_CYSCREEN)

   ScreenResolution = x & " : " & y

End Function

Hier eine Beispieldatei zum Download: Example File

Kategorie: IT Schlagwörter: , ,

Please notice: Comments are moderated. This could delay your comment. There is no need to submit your comment again.