bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Graphics > Adding AutoShapes

Adding AutoShapes

Summary: The graphics features of Excel allow you to add a number of predefined AutoShapes to a workbook. If you want to add shapes to the AutoShapes feature, however, you are out of luck. The shapes are apparently hard-coded into Excel, and cannot be modified. There are workarounds, however, and they are covered here. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)

The graphics features of Excel allow you to add a number of predefined shapes to a workbook. These shapes, called AutoShapes, cover a wide range of needs. If you want to add shapes to the AutoShapes feature, however, you are out of luck. The shapes are apparently hard-coded into Excel, and cannot be modified.

You can, however, add shapes to the Clip Gallery. If you format the shapes as WMF files, they are easy to add and easy to place within a worksheet. For instance, if you have a number of different flowchart symbols that you want to make available in Excel, all you need to do is save each symbol in the WMF format, and then import them into the Clip Gallery. (To save graphics in the WMF format, you will need to use a specialized graphics program, such as Paint Shop Pro or Corel Draw.)

If you don't want to use the Clip Gallery for some reason, you can simulate your own AutoShapes through a combination of macros and graphics in a hidden worksheet. The following general steps detail how to do this for a series of twenty flowchart symbols. The steps assume that you are reasonably comfortable writing macros and customizing toolbars.

  1. Open a template workbook, and make sure it has only a single worksheet.
  2. Place all the flowchart graphics on the worksheet.
  3. Create a new toolbar, name it MyShapes, and make sure it is associated with the template workbook.
  4. Add twenty buttons to the toolbar, one for each flowchart graphic. The idea is that clicking a button will add the associated flowchart shape to the active worksheet.
  5. Edit each button face to show as closely as possible each flowchart graphic. (This is the toughest part of these steps).
  6. Change the ToolTip text for each button, as desired. This is helpful so the user can understand the purpose of each flowchart graphic.
  7. In turn, select and name each of the flowchart graphics. (You name the graphics by selecting them and entering a name in the Name box at the left of the Formula bar.) For the purposes of these steps, assume you use names such as FlowObj1, FlowObj2, etc.
  8. Write twenty macros (one for each flowchart graphic) of the following kind:
  9. Sub AddFlowObj1()
        ThisWorkbook.Sheets(1).Shapes("FlowObj1").Copy
        ActiveSheet.Paste
    End Sub
    
  10. Assign each of the macros to the corresponding toolbar button.
  11. In the Workbook module of the template, add the following procedures:
  12. Private Sub Workbook_Open()
        Application.CommandBars("MyShapes").Visible = True
    End Sub
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Application.CommandBars("MyShapes").Delete
    End Sub
    
  13. Save the template as an Excel add-in.
  14. Restart Excel and use Tools | Add-ins to active your new add-in.

Tip #1995 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003


More Power! Expand your skills and make Excel really sing! It's all possible with macros. The best resource anywhere for macros is ExcelTips: The Macros. Check it out today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home
Vital News Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)