Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Sub udfDisplaySystemInfo()
' Procedure :   DisplaySystemInfo
' Description:  For Word97: display screen resolution & printyer; for Excel97 display lots more.
' Copyright:    Chris Greaves Inc.
' Inputs:       None.
' Returns:      None.
' Assumes:      None.
' Side Effects: None.
' Tested:       By a call from the user.
'needs 32 &16 bt api declarations to GetSystemMetrics
'Public Const SM_CXSCREEN = 0
'Public Const SM_CYSCREEN = 1
'' 32-bit API declaration for displaysysteminfo
'Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
'' 16-bit API declaration for displaysysteminfo
'Declare Function GetSystemMetrics16 Lib "user" Alias "GetSystemMetrics" (ByVal nIndex As Integer) As Integer
Dim strMsg As String
Dim VidWidth, VidHeight
strMsg = ""
    If Left(Application.Version, 1) = 5 Then        '   16-bit Excel
        VidWidth = GetSystemMetrics16(SM_CXSCREEN)
        VidHeight = GetSystemMetrics16(SM_CYSCREEN)
    Else                                            '   32-bit Excel
        VidWidth = GetSystemMetrics32(SM_CXSCREEN)
        VidHeight = GetSystemMetrics32(SM_CYSCREEN)
    End If
        strMsg = ""
        ' Following lines are available in Excel but not in Word!
        ' strMsg = "Operating System &  " & Application.OperatingSystem
        strMsg = strMsg & Chr(13) & "The current video mode is: " & VidWidth & " X " & VidHeight
'        strMsg = strMsg & Chr(13) & "Can Play Sounds = " & Application.CanPlaySounds
'        strMsg = strMsg & Chr(13) & "Can Record Sounds = " & Application.CanRecordSounds
        strMsg = strMsg & Chr(13) & "Your Current Printer is " & Application.ActivePrinter
'        strMsg = strMsg & Chr(13) & "Free Memory = " & Application.MemoryFree
    MsgBox strMsg, vbOKOnly, "System Information"
End Sub

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Sub udfDisplaySystemInfo()
' Procedure :   DisplaySystemInfo
' Description:  For Word97: display screen resolution & printyer; for Excel97 display lots more.
' Copyright:    Chris Greaves Inc.
' Inputs:       None.
' Returns:      None.
' Assumes:      None.
' Side Effects: None.
' Tested:       By a call from the user.
'needs 32 &16 bt api declarations to GetSystemMetrics
'Public Const SM_CXSCREEN = 0
'Public Const SM_CYSCREEN = 1
'' 32-bit API declaration for displaysysteminfo
'Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
'' 16-bit API declaration for displaysysteminfo
'Declare Function GetSystemMetrics16 Lib "user" Alias "GetSystemMetrics" (ByVal nIndex As Integer) As Integer
Dim strMsg As String
Dim VidWidth, VidHeight
strMsg = ""
    If Left(Application.Version, 1) = 5 Then        '   16-bit Excel
        VidWidth = GetSystemMetrics16(SM_CXSCREEN)
        VidHeight = GetSystemMetrics16(SM_CYSCREEN)
    Else                                            '   32-bit Excel
        VidWidth = GetSystemMetrics32(SM_CXSCREEN)
        VidHeight = GetSystemMetrics32(SM_CYSCREEN)
    End If
        strMsg = ""
        ' Following lines are available in Excel but not in Word!
        ' strMsg = "Operating System &  " & Application.OperatingSystem
        strMsg = strMsg & Chr(13) & "The current video mode is: " & VidWidth & " X " & VidHeight
'        strMsg = strMsg & Chr(13) & "Can Play Sounds = " & Application.CanPlaySounds
'        strMsg = strMsg & Chr(13) & "Can Record Sounds = " & Application.CanRecordSounds
        strMsg = strMsg & Chr(13) & "Your Current Printer is " & Application.ActivePrinter
'        strMsg = strMsg & Chr(13) & "Free Memory = " & Application.MemoryFree
    MsgBox strMsg, vbOKOnly, "System Information"
End Sub

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1