leighhobson89
New Member
- Joined
- Aug 25, 2016
- Messages
- 36
Good Morning guys!
Looking at the following code (which will have a procedure under the IF statement eventually), cn anyone tell me why already I am receiving the error in the title of this post?
I can't see any problems that are causing this specific error. Moreover, I have tried adding "End Function" to each Function to no avail.
Please help!
Looking at the following code (which will have a procedure under the IF statement eventually), cn anyone tell me why already I am receiving the error in the title of this post?
Code:
Sub CheckVBAVersion()
'Open an instance of each required app
' Test which version of VBA you are using.
#If VBA7 Then
' API function to locate a window.
Declare PtrSafe Function FindWindow Lib "user32" _ [COLOR=#ff0000]'THIS BLOCK OF CODE[/COLOR]
Alias "FindWindowA" ( _ [COLOR=#ff0000]'IS HIGHLIGHTED[/COLOR]
ByVal lpClassName As String, _ [COLOR=#ff0000]' WHEN ERROR[/COLOR]
ByVal lpWindowName As String) As LongPtr [COLOR=#ff0000]' IS THROWN[/COLOR]
' API function to retrieve a window's dimensions.
Declare PtrSafe Function GetWindowRect Lib "user32" ( _
ByVal hwnd As LongPtr, _
lpRect As RECT) As Long
#Else
' API function to locate a window.
Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
' API function to retrieve a window's dimensions.
Declare Function GetWindowRect Lib "user32" ( _
ByVal hwnd As Long, _
lpRect As RECT) As Long
#End If
End Sub
I can't see any problems that are causing this specific error. Moreover, I have tried adding "End Function" to each Function to no avail.
Please help!