Hi... I have a worksheet that has this code:
Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" _
(ByVal nIndex As Long) As Long
Declare Function GetSystemMetrics16 Lib "user" Alias "GetSystemMetrics" _
(ByVal nIndex As Integer) As Integer
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Sub DisplayVideoInfo()
Dim vidWidth As Integer, vidHeight As Integer
Dim msg As String, Style As String
Dim Title As String, Response As String
If Left(Application.Version, 1) = 5 Then
vidWidth = GetSystemMetrics16(SM_CXSCREEN)
vidHeight = GetSystemMetrics16(SM_CYSCREEN)
Else
vidWidth = GetSystemMetrics32(SM_CXSCREEN)
vidHeight = GetSystemMetrics32(SM_CYSCREEN)
End If
msg = "O Football Trading Manager foi desenhado para ser usado com uma " & "Resolução de 1280 X 800 pixéis." & vbCrLf & "Especialmente no que diz respeito à largura do ecrã - '1280 Pixéis'." _
& vbNewLine & vbNewLine
msg = msg & "A Resolução actual do ecrã do seu computador é: "
msg = msg & vidWidth & " X " & vidHeight & " pixéis." & vbNewLine & vbNewLine
If vidWidth = 1280 Then
msg = msg & "Não é necessário ajustar a Resolução do seu ecrã uma vez que possui uma resolução com a largura pretendida." & vbCrLf & "Pode continuar a usar o Football Trading Manager normalmente."
Else
msg = msg & "A largura do seu ecrã é diferente de 1280 pixeis!" & vbCrLf & "Para centrar o ecrã do Football Trading Manager de acordo com o tamanho do seu monitor pode proceder de duas formas:" & vbCrLf & "1 - Alterar a Resolução para 1280 X 800 pixéis" & vbCrLf & "2 - Usar o Botão ZOOM da ferramenta do Teste de Resolução e inserir o valor apropriado à resolução do seu ecrã." & vbCrLf & " " & vbCrLf & "São exemplos de alguns valores de ZOOM a inserir, para as seguintes resoluções (Largura apenas):" & vbCrLf & "1024 pixéis -> 80%" & vbCrLf & "800 pixéis -> 61%" & vbCrLf & " " & vbCrLf & "Deve introduzir estes valores na ferramenta de ZOOM do Football Trading Manager e assim toda a aplicação passará a ter a largura apropriada ao tamanho do seu monitor. Obrigado"
End If
Style = vbOKOnly + vbInformation
Title = "Teste de Resolução do Ecrã."
Response = MsgBox(msg, Style, Title)
End Sub
This code runs perfectly in every office versions 2007/10/13. But today i tryed to opens the workbook in a windows 7 ultimate 64 bits and the follwing error came up: "Compile error in hidden module: module1" -> Module 1 is where i have this code.
So i started looking on google for this error and came up with a error from the 64 bit version and the built up version of the workbook. So i checked on google through SystemMetrics32 for 64 bits and in some pages they say that for 64 bits excel versions, the code line had to be replaced for this:
Declare Ptrsafe Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
The thing is i dont know how to had this to my previous code and make it in a way that it would work on every version 32/64 bits.
Can anyone help please?
thank you.
Bookmarks