[VBA] Edit custom border

[VBA] Edit custom border

Anonymous
Not applicable
656 Views
2 Replies
Message 1 of 3

[VBA] Edit custom border

Anonymous
Not applicable

I want to edit a non-default border in a sheet. I want to edit the amount of Horizontal- and Vertical- Zone Count to be more specific. Basically the border is the exactly the same as the default border, however some extra lines have been added and other text styles are being used.

 

I can add the border using:

Sheet.AddBorder( BorderDefinition As Variant, [PromptStrings] As Variant ) As Border 

I can't control any part of the Border Object after adding it to the sheet. (And I have no clue what PromptStrings does.)

 

However when I compare the AddBorder method with AddDefaultBorder method:

 

Sheet.AddDefaultBorder( [HorizontalZoneCount] As Variant, [HorizontalZoneLabelMode] As Variant, _
	                [VerticalZoneCount] As Variant, [VerticalZoneLabelMode] As Variant, _
		        [LabelFromBottomRight] As Variant, [DelimitByLines] As Variant, _
		        [Centermarks] As Variant, [TopMargin] As Variant, _
		        [BottomMargin] As Variant, [LeftMargin] As Variant, _
		        [RightMargin] As Variant, [TextStyle] As Variant, _
		        [TextLayer] As Variant, [LineLayer] As Variant ) As DefaultBorder

The user has way more control over every or any aspect of the border.

 

Also the Border Object is controlled differently compared to the DefaultBorder Object. Border Object basically is very very limitted and DefaultBorder Object is not. However when I try to edit both borders by hand, using "Edit Instance" both borders are controlled very similar.

 

 

So... Using VBA, how does one edit the amount of Horizontal and Vertical Zones in a non-default border? Or is there a way to make the custom border default?

 

Kind regards

 

0 Likes
657 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk

Currently you can't set a custom border definition as default border definition. From you description I don't see why you want to use a custom border instead of the default border? Can't that default border satisfy your requirement? Use the AddDefaultBorder you can specify the zones as you like, so can you tell me what are your requirements the default border can't work for you?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

jpi656UL
Participant
Participant

I have the same issue - the reason I also would like to have the possibility to change the custom border parameters ,especially the ZONES is that for custom border I can add anchoring points, some descriptions, symbols etc. with the proper position regardless of the sheet size (for example always 10mm from the left edge). Once the custom zone border is defined by me I manually have to always change it before placing as to suit my sheet sizes (I prefer less zones for A4, more for A0). I would like to have the border adjusted each time I change the sheet and now every sheet change I need to remove the border and place it with proper zones, otherwise they always stay the same (the last inputted values are remembered). With default border the situation is different - once placed the zones adjust automatically to paper size.

0 Likes