Hi,
I am a newbie at Excel/VBA. This is my first posting.
I copied these functions from a book and placed in the General Declarations section as shown, but I got this compile error:
Compile error: Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules.
Here are the functions:
Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long
I am not sure how to fix this. I moved these Declarations inside the calling Sub, but then I got another compile error:
Only comments may appear after End Sub, End Function, or End Property
I am using Excel 2000 on Win2000 OS. If you have any ideas on what the problem might be, I would appreciate hearing them! Thanks.
I am a newbie at Excel/VBA. This is my first posting.
I copied these functions from a book and placed in the General Declarations section as shown, but I got this compile error:
Compile error: Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules.
Here are the functions:
Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long
I am not sure how to fix this. I moved these Declarations inside the calling Sub, but then I got another compile error:
Only comments may appear after End Sub, End Function, or End Property
I am using Excel 2000 on Win2000 OS. If you have any ideas on what the problem might be, I would appreciate hearing them! Thanks.