Changing the size of a drawing sheet

Changing the size of a drawing sheet

Anonymous
Not applicable
906 Views
4 Replies
Message 1 of 5

Changing the size of a drawing sheet

Anonymous
Not applicable

I'm trying to set the heigh of my sheet to 20% bigger than the height of the view, but i get the following errors:

Anyone know what i'm doing wrong?

 

Error on Line 5 : Property 'Size' is 'ReadOnly'.
Error on Line 6 : Property 'Height' is 'ReadOnly'.

 

SyntaxEditor Code Snippet

Height = ThisDrawing.Sheet("Sheet:2").View("1To1").Height
Width  =  ThisDrawing.Sheet("Sheet:2").View("1To1").Width

With ThisDrawing.Sheet("Sheet:2")
    .Size = DrawingSheetSizeEnum.kCustomDrawingSheetSize
    .Height = Round(Height*1.2,0)
    
End With

 Regards

 

Mark

0 Likes
Accepted solutions (1)
907 Views
4 Replies
Replies (4)
Message 2 of 5

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

Try to declare your sheet first and then modify the options

SyntaxEditor Code Snippet

Dim odrawdoc As DrawingDocument
odrawdoc = ThisApplication.ActiveDocument
Dim osheet As Sheet
osheet = odrawdoc.ActiveSheet

With osheet
	.Size = kCustomDrawingSheetSize
	.Width = 100
	.Height = 100
End With
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks.

 

...but how do i define sheet 2? It's unlikley to be the activesheet

 

Regards

 

Mark

 

 

 

0 Likes
Message 4 of 5

frederic.vandenplas
Collaborator
Collaborator
Accepted solution

Hi,

 

Now i see your error, you need to add a S to Sheet

odrawdoc.Sheets("Sheet:2") instead of
odrawdoc.Sheet("Sheet:2")

 

SyntaxEditor Code Snippet

Dim odrawdoc As DrawingDocument
odrawdoc = ThisApplication.ActiveDocument
Dim osheet As Sheet
osheet = odrawdoc.Sheets("Sheet:2")

With osheet
	.Size = kCustomDrawingSheetSize
	.Width = 100
	.Height = 100
End With

 

If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks. 

 

I had tried that, but forgot the "s" on the end of Sheet

 

doh!

0 Likes