iLogic to Change Active Sheet Format

iLogic to Change Active Sheet Format

wtriplett
Contributor Contributor
634 Views
2 Replies
Message 1 of 3

iLogic to Change Active Sheet Format

wtriplett
Contributor
Contributor

Hello-

 

I have multiple sheet formats for my title blocks.

I use a form to select the size and style sheet.

Mu current code will add a sheet with the required Sheet format but I need to find a way to modify this code to change the Sheet Format on the active sheet.

 

I have looked everywhere on this forum and I would appreciate any help.

 

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oFormat As SheetFormat

If Parameter.Value("SheetSize") = "B" And Parameter.Value("TBStyle") = "VERTICAL" Then
	oFormat = oDrawDoc.SheetFormats.Item("B VERTICAL")

Dim oSheet As Sheet
oSheet = oDrawDoc.Sheets.AddUsingSheetFormat(oFormat)

End If

 

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

Ralf_Krieg
Advisor
Advisor

Hello

 

There is a property Size in the Sheet object. The sheet format can only selected by adding a new sheet. If you need to change (why???), you have to delete the current (active) sheet and add a new one AFAIK.

 

 

Dim oDrawdoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDrawdoc.ActiveSheet

oSheet.Size = kA2DrawingSheetSize

'possible SheetSizeEnums
'Name	  					Value	Description  
'k12x18InDrawingSheetSize	9999	12 in x 18 in (typically For architectural drawings). 
'k18x24InDrawingSheetSize	10000	18 in x 24 in (typically For architectural drawings). 
'k24x36InDrawingSheetSize	10001	24 in x 36 in (typically For architectural drawings). 
'k30x42InDrawingSheetSize	10003	30 in x 42 in (typically For architectural drawings). 
'k36x48InDrawingSheetSize	10002	36 in x 48 in (typically For architectural drawings). 
'k9x12InDrawingSheetSize	9998	9 in x 12 in (typically For architectural drawings). Default page orientation Is Portrait. 
'kA0DrawingSheetSize		9993	A0 size (typically For metric units). 
'kA1DrawingSheetSize		9994	A1 size (typically For metric units). 
'kA2DrawingSheetSize		9995	A2 size (typically For metric units). 
'kA3DrawingSheetSize		9996	A3 size (typically For metric units). 
'kA4DrawingSheetSize		9997	A4 size (typically For metric units). 
'kADrawingSheetSize			9987	A size (typically For inch units). 
'kBDrawingSheetSize			9988	B size (typically For inch units). 
'kCDrawingSheetSize			9989	C size (typically For inch units). 
'kCustomDrawingSheetSize	9986	Custom size. Does (may) Not fit one Of the standard sizes. 
'kDDrawingSheetSize			9990	D size (typically For inch units). 
'kDefaultDrawingSheetSize	9985	Specifies the Default setting. The more strongly typed value Is the one returned In a query. 
'kEDrawingSheetSize			9991	E size (typically For inch units). 
'kFDrawingSheetSize			9992	F size (typically For inch units). 

 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 3

M
Contributor
Contributor

This line of code sets the current active sheet to a size You specify

 

ActiveSheet.ChangeSize ("A1", MoveBorderItems= True)

Where "A1" is the size You specify what it should be. the names (eg sizes) are directly taken from the Edit sheet > sheet size menu

SheetSizeNames.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

APDSU 2015-2021
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.
0 Likes