Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have written a drawing programme in excel to produce floor plans &
elevations for sheds. I now want to distribute the programme but need to have all of the scaling to change to the current users screen size. I am after ways of VB knowing what screen size the user has & how I can set my page tops etc. to suit this so the shapes are positioned correctly on the page. At the moment I have hard coded in where my shapes are to start positioning but this is no good when a new user has a different monitor size as it throws it all over the screen. Also am looking for ways of locking users out of code and creating distributor versions so that we have the ability to monitor how they are using there programme & what they are using it for. Urgent help required. thanks -- SS |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will give you the screen resolution:
Option Explicit Private Const SM_CXSCREEN = 0 Private Const SM_CYSCREEN = 1 Private Const SM_CYCAPTION = 4 Private Const SM_CXBORDER = 5 Private Const SM_CYBORDER = 6 Private Const SM_CXFULLSCREEN = 16 Private Const SM_CYFULLSCREEN = 17 Private Const SM_CXVIRTUALSCREEN As Long = 78 Private Const SM_CMONITORS As Long = 80 Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Sub getScreenResolution(lWidth As Long, lHeight As Long) lWidth = GetSystemMetrics(SM_CXSCREEN) lHeight = GetSystemMetrics(SM_CYSCREEN) End Sub Sub test() Dim lWidth As Long Dim lHeight As Long getScreenResolution lWidth, lHeight MsgBox lWidth & " x " & lHeight, , "screen resolution" End Sub RBS "StevenS" wrote in message ... I have written a drawing programme in excel to produce floor plans & elevations for sheds. I now want to distribute the programme but need to have all of the scaling to change to the current users screen size. I am after ways of VB knowing what screen size the user has & how I can set my page tops etc. to suit this so the shapes are positioned correctly on the page. At the moment I have hard coded in where my shapes are to start positioning but this is no good when a new user has a different monitor size as it throws it all over the screen. Also am looking for ways of locking users out of code and creating distributor versions so that we have the ability to monitor how they are using there programme & what they are using it for. Urgent help required. thanks -- SS |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks so much. Have got this working will see how I go on other computers.
-- SS "RB Smissaert" wrote: This will give you the screen resolution: Option Explicit Private Const SM_CXSCREEN = 0 Private Const SM_CYSCREEN = 1 Private Const SM_CYCAPTION = 4 Private Const SM_CXBORDER = 5 Private Const SM_CYBORDER = 6 Private Const SM_CXFULLSCREEN = 16 Private Const SM_CYFULLSCREEN = 17 Private Const SM_CXVIRTUALSCREEN As Long = 78 Private Const SM_CMONITORS As Long = 80 Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Sub getScreenResolution(lWidth As Long, lHeight As Long) lWidth = GetSystemMetrics(SM_CXSCREEN) lHeight = GetSystemMetrics(SM_CYSCREEN) End Sub Sub test() Dim lWidth As Long Dim lHeight As Long getScreenResolution lWidth, lHeight MsgBox lWidth & " x " & lHeight, , "screen resolution" End Sub RBS "StevenS" wrote in message ... I have written a drawing programme in excel to produce floor plans & elevations for sheds. I now want to distribute the programme but need to have all of the scaling to change to the current users screen size. I am after ways of VB knowing what screen size the user has & how I can set my page tops etc. to suit this so the shapes are positioned correctly on the page. At the moment I have hard coded in where my shapes are to start positioning but this is no good when a new user has a different monitor size as it throws it all over the screen. Also am looking for ways of locking users out of code and creating distributor versions so that we have the ability to monitor how they are using there programme & what they are using it for. Urgent help required. thanks -- SS |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks. Can you explain what the code is saying as i am only a fairly novice
programmer. -- SS "RB Smissaert" wrote: This will give you the screen resolution: Option Explicit Private Const SM_CXSCREEN = 0 Private Const SM_CYSCREEN = 1 Private Const SM_CYCAPTION = 4 Private Const SM_CXBORDER = 5 Private Const SM_CYBORDER = 6 Private Const SM_CXFULLSCREEN = 16 Private Const SM_CYFULLSCREEN = 17 Private Const SM_CXVIRTUALSCREEN As Long = 78 Private Const SM_CMONITORS As Long = 80 Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Sub getScreenResolution(lWidth As Long, lHeight As Long) lWidth = GetSystemMetrics(SM_CXSCREEN) lHeight = GetSystemMetrics(SM_CYSCREEN) End Sub Sub test() Dim lWidth As Long Dim lHeight As Long getScreenResolution lWidth, lHeight MsgBox lWidth & " x " & lHeight, , "screen resolution" End Sub RBS "StevenS" wrote in message ... I have written a drawing programme in excel to produce floor plans & elevations for sheds. I now want to distribute the programme but need to have all of the scaling to change to the current users screen size. I am after ways of VB knowing what screen size the user has & how I can set my page tops etc. to suit this so the shapes are positioned correctly on the page. At the moment I have hard coded in where my shapes are to start positioning but this is no good when a new user has a different monitor size as it throws it all over the screen. Also am looking for ways of locking users out of code and creating distributor versions so that we have the ability to monitor how they are using there programme & what they are using it for. Urgent help required. thanks -- SS |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The main thing is the function GetSystemMetrics.
This is a Windows API function and these functions can be used in Excel by declaring it like this. Once it has been declared properly you can call it from your Excel code and use the results. These Windows API functions are very useful as they allow you to do things that can't be done in regular Excel VBA code. I would get some free API that lists all these functions and tells you how to declare and use them, for example: http://www.mentalis.org/agnet/apiguide.shtml nIndex is just an argument for the GetSystemMetrics function and all the possible (maybe there are more) are given in the constants that are declared privately. I am only using SM_CXSCREEN and SM_CYSCREEN, but you could use other ones to get other parameters of the screen. lWidth and lHeight are arguments for the Sub getScreenResolution and these arguments (variables) will be changed by this Sub and then will be available to the Sub that calls getScreenResolution, in this case the Sub test. That really is it. Once you start using these API's you will see how useful they are. RBS "StevenS" wrote in message ... Thanks. Can you explain what the code is saying as i am only a fairly novice programmer. -- SS "RB Smissaert" wrote: This will give you the screen resolution: Option Explicit Private Const SM_CXSCREEN = 0 Private Const SM_CYSCREEN = 1 Private Const SM_CYCAPTION = 4 Private Const SM_CXBORDER = 5 Private Const SM_CYBORDER = 6 Private Const SM_CXFULLSCREEN = 16 Private Const SM_CYFULLSCREEN = 17 Private Const SM_CXVIRTUALSCREEN As Long = 78 Private Const SM_CMONITORS As Long = 80 Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Sub getScreenResolution(lWidth As Long, lHeight As Long) lWidth = GetSystemMetrics(SM_CXSCREEN) lHeight = GetSystemMetrics(SM_CYSCREEN) End Sub Sub test() Dim lWidth As Long Dim lHeight As Long getScreenResolution lWidth, lHeight MsgBox lWidth & " x " & lHeight, , "screen resolution" End Sub RBS "StevenS" wrote in message ... I have written a drawing programme in excel to produce floor plans & elevations for sheds. I now want to distribute the programme but need to have all of the scaling to change to the current users screen size. I am after ways of VB knowing what screen size the user has & how I can set my page tops etc. to suit this so the shapes are positioned correctly on the page. At the moment I have hard coded in where my shapes are to start positioning but this is no good when a new user has a different monitor size as it throws it all over the screen. Also am looking for ways of locking users out of code and creating distributor versions so that we have the ability to monitor how they are using there programme & what they are using it for. Urgent help required. thanks -- SS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to programme this in excel? | Excel Discussion (Misc queries) | |||
Why I can copy nothing from excel to word or other programme? | Excel Worksheet Functions | |||
need to find a excel programme for rota's | Excel Discussion (Misc queries) | |||
Excel Programme Management | Excel Discussion (Misc queries) | |||
excel vba programme | Excel Programming |