ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with Application.Width (https://www.excelbanter.com/excel-programming/289959-problem-application-width.html)

Leo

Problem with Application.Width
 
I have a troubles to set up width of application's window.
Due to some reasons I want my application's window cover 10
columns exactly(e.g. user see only 10 columns)
If I handy move application's window so it cover 10 columns
and check application's width by this code:

MsgBox Application.Width

I get number 492 ( I read in help that it is in POINT - about 1/72 inch)

If I run next code:

Sub fghfs()
For i = 1 To 10
a = a + ActiveSheet.Columns(i).ColumnWidth
Next
MsgBox a
End Sub

I get number 81 - and in the help I read that it the SAME point (???)

Can anybody explain me difference between points in width
in two cases?
At the end I need code like:

Application.wide = "Sum of wides of 10 columns "

Thanks
Leo

Tom Ogilvy

Problem with Application.Width
 
Think you misread the help. Width is in points. For ColumnWidth it says:

One unit of column width is equal to the width of one character in the
Normal style. For proportional fonts, the width of the character 0 (zero) is
used.

Use the Width property to return the width of a column in points.



--

Regards,

Tom Ogilvy



"Leo" wrote in message
om...
I have a troubles to set up width of application's window.
Due to some reasons I want my application's window cover 10
columns exactly(e.g. user see only 10 columns)
If I handy move application's window so it cover 10 columns
and check application's width by this code:

MsgBox Application.Width

I get number 492 ( I read in help that it is in POINT - about 1/72 inch)

If I run next code:

Sub fghfs()
For i = 1 To 10
a = a + ActiveSheet.Columns(i).ColumnWidth
Next
MsgBox a
End Sub

I get number 81 - and in the help I read that it the SAME point (???)

Can anybody explain me difference between points in width
in two cases?
At the end I need code like:

Application.wide = "Sum of wides of 10 columns "

Thanks
Leo




Leo

Problem with Application.Width
 
"Tom Ogilvy" wrote in message ...
Think you misread the help. Width is in points. For ColumnWidth it says:

One unit of column width is equal to the width of one character in the
Normal style. For proportional fonts, the width of the character 0 (zero) is
used.

Use the Width property to return the width of a column in points.



--

Regards,

Tom Ogilvy

================================================== =====
Thanks Tom , I really misread the help ....
Regards, Leo

"Leo" wrote in message
om...
I have a troubles to set up width of application's window.
Due to some reasons I want my application's window cover 10
columns exactly(e.g. user see only 10 columns)
If I handy move application's window so it cover 10 columns
and check application's width by this code:

MsgBox Application.Width

I get number 492 ( I read in help that it is in POINT - about 1/72 inch)

If I run next code:

Sub fghfs()
For i = 1 To 10
a = a + ActiveSheet.Columns(i).ColumnWidth
Next
MsgBox a
End Sub

I get number 81 - and in the help I read that it the SAME point (???)

Can anybody explain me difference between points in width
in two cases?
At the end I need code like:

Application.wide = "Sum of wides of 10 columns "

Thanks
Leo



All times are GMT +1. The time now is 12:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com