Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Vid Fischer   on Oct 10 In MS Office Category.

  
Question Answered By: Olga Allen   on Oct 10

The solution is good. But calling the rectangle_make program for each sheet
will be cumbersome.
I have provided a simplified version below:

Sub Rectangle_Sheets()

' This procedure calls the rectangle_make macro  with teh sheet  Number as the
argument

' Define an array with the sheet numbers that you want the rectangle in
RecSh = Array(1, 2, 3, 4, 7, 9, 10)
' Loop thru the array and call the "rectangle_make" macro for each sheet
' You don't need to select the sheet
For i = 1 To UBound(RecSh)
Call rectangle_make(RecSh(i))
Next i

End Sub
--------------------------------------------------------------------------------\
-----
' This macro is called by the main program
Sub rectangle_make(ShNo)

Set myDocument = Worksheets(ShNo)
' Add a rectangle at 150, 50 of size 300x200
myDocument.Shapes.AddShape msoShapeRectangle, 150, 50, 300, 200

End Sub

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 


Tagged: