XlBorderWeight enumeration

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I wanted to assign value to this line
Code:
    Workbooks(1).Worksheets(1).Cells(xrow, xcol).Borders.Weight =

So I used Object Browser, and typed Borders then clicked on weight and I read the following:

Property Weight As Variant

Property Weight As Variant that is all! nothing else.

I had to google it and found that:

Borders.weight "[FONT=&quot]Returns or sets an [/FONT][FONT=&quot]XlBorderWeight[/FONT][FONT=&quot] value that represents the weight of the border."

[/FONT]
Then I went back to vba Object browser and typed XlBorderWeight to find all values. Is that the way how to find what the values I need to pass to Borders.weight? Why Object Browser does it tell me Weight values are in XLBordersWeight?

How can I or someone link Weight with XlBorderWeight?

Same apply with Borders.Style and XlLineStyle

Thank you so much.



 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi,
should find answer in VBA helpfile

https://docs.microsoft.com/en-us/do...e.interop.excel.xlborderweight?view=excel-pia
which shows members & their values.

You can use XLBorderWeight Enum in you code

Code:
Dim BorderWeight As XlBorderWeight


BorderWeight = xlHairline

you will find when you place = sign after the variable that you will be presented with the intelliSense showing the List Members

Should be able to do same for XlLineStyle Enum


Hope Helpful

Dave
 
Last edited:
Upvote 0
"you will find when you place = sign after the variable that you will be presented with the intelliSense showing the List Members"

Thanks for your reply but that is not happening?
Do I need to do anything with the setting so I can see these options once I type =
Thank you once again
 
Upvote 0
In the VbE goto Tools > options & make sure that both "Auto list members" and "Auto quick info" are checked.
 
Upvote 0
Thank you. They both checked but still noting comes up. When I type this code
Code:
workbooks(1).worksheets(1).cells(1,1).borders.weight =

only after typing workbooks(1).
I get a list of option but then when I continue typing nothing will come after worksheets(1). and nothing after cells(1,1). and nothing after borders. and nothing after weight=

Thank you
 
Upvote 0
No they wont, but if you used the code that dmt32 provided, you would have got the intellisense.
 
Upvote 0
I get a list of option but then when I continue typing nothing will come after worksheets(1)
There are a lot of syntaxes that don't support Intellisense, and Worksheets() is one. That one I understand, because Worksheets can return a single sheet with all the usual properties and methods, or an array of sheets which have different P&Ms (e.g. FillAcrossSheets). If you used a worksheet variable, Intellisense would appear.

Intellisense works for Range(), not for Rows() and Columns(); not sure why, but haven't thought hard about it.
 
Last edited:
Upvote 0
Thank you, but my point how is how can I know border.weight takes one of XlBorderWeight values?
Ok these days I can do google search but lets say and I think Excel/VBA is way before the Internet.
Lets say I am in 1990 and I want to write this code

Code:
 workbooks(1).worksheets(1).cells(1,1).borders.weight =

Now I stuck here and I want to know what value I should write?

how can I know when Object Browser is not telling me anything and I do not have Internet to google? and possibly this site was not existed. Thank you very much.
 
Upvote 0
In Help for Borders.Weight,

Borders.Weight Property
Returns or sets a XlBorderWeight value that represents the weight of the border.

... and xlBorderWeight is hyperlinked to the enumeration values.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top