-
Solved: Getting result from Public Function
If I insert the following in a module ("ScrSize") in Personal.xls, what is the code to return the ScreenWidth value for use in another VBA Project?
MD
[VBA]
Private Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Const SM_CXSCREEN = 0
Const SM_CYSCREEN = 1
Public Function ScreenWidth()
ScreenWidth = GetSystemMetrics(SM_CXSCREEN)
End Function
Public Function ScreenHeight()
ScreenHeight = GetSystemMetrics(SM_CYSCREEN)
End Function
[/VBA]
-
Name the project with the function something useful (let's say "MyProject").
Then in the other workbook in VBE select Tools | References.
Add MyProject as a reference.
Then just call the function as you normally would.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules