Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default listrows property

Im creating a userform that list a multicolumn range in a
combobox. This user form will be used on different
computers with different resolutions. I use windows api's
to add maximize button to form. I would like tto put the
combobox at the top of the form and use the maximum amount
of screen space to dispay listrows. is there a way to
make the list rows property relative to screen size or
userform size. right now i am trying "if then" with
different resolutions ie: if resolution is 800X600 then
listrows = 32 so on and so forth... any help would be
appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default listrows property

Jim,

I haven't tried myself but I would have thought this is very simple to do.
Have you tried to just set it according to your algorithm in the Userform
initialise or activate event code, such as

Combobox1.ListRow = 32

or within a Case statement when you have determined your userform size with
a test based upon that size.

Is that helpful, or have I missed the crux of the question?

--

HTH

Bob Phillips

"jim C." wrote in message
...
Im creating a userform that list a multicolumn range in a
combobox. This user form will be used on different
computers with different resolutions. I use windows api's
to add maximize button to form. I would like tto put the
combobox at the top of the form and use the maximum amount
of screen space to dispay listrows. is there a way to
make the list rows property relative to screen size or
userform size. right now i am trying "if then" with
different resolutions ie: if resolution is 800X600 then
listrows = 32 so on and so forth... any help would be
appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default listrows property

when designing my userform, I was using 1024x768 screen
resolution. then it dawned on me that there will be
people using the form at 800x600. which of course changes
everything... rookie mistake. lol i was hoping there was
an easier way then testing each resolution and using case
statements. thank you for your help.
-----Original Message-----
Jim,

I haven't tried myself but I would have thought this is

very simple to do.
Have you tried to just set it according to your algorithm

in the Userform
initialise or activate event code, such as

Combobox1.ListRow = 32

or within a Case statement when you have determined your

userform size with
a test based upon that size.

Is that helpful, or have I missed the crux of the

question?

--

HTH

Bob Phillips

"jim C." wrote in message
...
Im creating a userform that list a multicolumn range in

a
combobox. This user form will be used on different
computers with different resolutions. I use windows

api's
to add maximize button to form. I would like tto put

the
combobox at the top of the form and use the maximum

amount
of screen space to dispay listrows. is there a way to
make the list rows property relative to screen size or
userform size. right now i am trying "if then" with
different resolutions ie: if resolution is 800X600 then
listrows = 32 so on and so forth... any help would be
appreciated.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default listrows property

Hi Jim c.

Try get from register. Put this code on standard module and run the test.

Public Const vStr As Long = 255
Public Const REG_BINARY = 3&
Public Const REG_DWORD = 4&
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
(ByVal hKey As Long, ByVal lpSubKey As String, _
phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA"
_
(ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
ByRef lpType As Long, _
ByVal lpData As String, _
ByRef lpcbData As Long) As Long ' Note that if you declare the lpData
_
'parameter as String, you must pass
it By Value.
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002


'Get Registry Value, Arguments:
'1 - Reg Key (Ex.: HKEY_LOCAL_MACHINE),
'2 - Reg SubKey (Ex.: "Software\Microsoft\Windows\CurrentVersion"),
'3 - Name of Value (Ex.:"ProgramFilesDir" or "" for default)
Function GetRegValue(Key As Long, SubKey As String, ValueName As String) As
String
Dim RetStr As String * vStr 'Fixed-length strings
Dim fctRet As Long
Dim OpenKeyHdl As Long
Dim vType As Long
Dim vLen As Long
Dim i As Integer

GetRegValue = "Error"
vLen = vStr
fctRet = RegOpenKey(Key, SubKey, OpenKeyHdl)
If fctRet < 0 Then Exit Function

fctRet = RegQueryValueEx(OpenKeyHdl, ValueName, 0&, vType, RetStr, vLen)
RegCloseKey OpenKeyHdl
If fctRet < 0 Then Exit Function

If vType = REG_BINARY Then
GetRegValue = ""
For i = 1 To vLen
GetRegValue = GetRegValue _
& IIf(Len(Hex(Asc(Mid(RetStr, i, 1)))) = 1, "0", "") _
& Hex(Asc(Mid(RetStr, i, 1))) & " "
Next
Exit Function
End If

If vType = REG_DWORD Then
GetRegValue = "0x"
For i = 4 To 1 Step -1
GetRegValue = GetRegValue _
& IIf(Len(Hex(Asc(Mid(RetStr, i, 1)))) = 1, "0", "") _
& Hex(Asc(Mid(RetStr, i, 1)))
Next
Exit Function
End If

GetRegValue = Left(RetStr, vLen - 1)
End Function

Private Sub TestGet()
'Test Screen resolution
MsgBox
Application.WorksheetFunction.Clean(GetRegValue(HK EY_LOCAL_MACHINE,
"Config\0001\Display\Settings", "Resolution"))
End Sub


HTH

---
Orlando Magalhães Filho

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)



"jim c." escreveu na mensagem
...
when designing my userform, I was using 1024x768 screen
resolution. then it dawned on me that there will be
people using the form at 800x600. which of course changes
everything... rookie mistake. lol i was hoping there was
an easier way then testing each resolution and using case
statements. thank you for your help.
-----Original Message-----
Jim,

I haven't tried myself but I would have thought this is

very simple to do.
Have you tried to just set it according to your algorithm

in the Userform
initialise or activate event code, such as

Combobox1.ListRow = 32

or within a Case statement when you have determined your

userform size with
a test based upon that size.

Is that helpful, or have I missed the crux of the

question?

--

HTH

Bob Phillips

"jim C." wrote in message
...
Im creating a userform that list a multicolumn range in

a
combobox. This user form will be used on different
computers with different resolutions. I use windows

api's
to add maximize button to form. I would like tto put

the
combobox at the top of the form and use the maximum

amount
of screen space to dispay listrows. is there a way to
make the list rows property relative to screen size or
userform size. right now i am trying "if then" with
different resolutions ie: if resolution is 800X600 then
listrows = 32 so on and so forth... any help would be
appreciated.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NumberFormat property JohnP[_2_] Setting up and Configuration of Excel 1 March 25th 11 01:00 PM
Forecasting Property Tax sfranger2003 Excel Discussion (Misc queries) 3 March 2nd 10 12:24 AM
Row Height property CY Excel Discussion (Misc queries) 1 September 21st 07 05:50 AM
ScrollBar property Ben Excel Discussion (Misc queries) 1 October 31st 05 06:25 AM
.Visible Property Jollynicechap Excel Programming 1 July 8th 03 09:06 PM


All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"