Creating diagrams in Userforms

dave8

Active Member
Joined
Jul 8, 2007
Messages
275
I'm using Excel 2007. Is it possible to create shapes on userforms (i.e., arrows, circles, etc)?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi David

The way I would do it is to use a mirror of the userform picture in a worksheet.
It's very easy to set up and if you want to change the shapes at runtime you can easily do it in the mirror and update the userform picture.

This is how you can do it:

- in a worksheet insert an empty chartobject
- resize it to the dimensions of the userform
- draw your shapes in the chart object
- export the chart to a file
- import the file to the userform background (picture)

These are the basics.
You can hide the worksheet and use vba to make some or all of this automatic.

Remarks:
This way you can display a number of shapes anywhere in the userform.
An alternative is to insert an image control in the worksheet and import the picture into it.

There may be other solutions involving programming with the windows API.
 
Upvote 0
Hi David

The way I would do it is to use a mirror of the userform picture in a worksheet.
It's very easy to set up and if you want to change the shapes at runtime you can easily do it in the mirror and update the userform picture.

This is how you can do it:

- in a worksheet insert an empty chartobject
- resize it to the dimensions of the userform
- draw your shapes in the chart object
- export the chart to a file
- import the file to the userform background (picture)

These are the basics.
You can hide the worksheet and use vba to make some or all of this automatic.

Remarks:
This way you can display a number of shapes anywhere in the userform.
An alternative is to insert an image control in the worksheet and import the picture into it.

There may be other solutions involving programming with the windows API.

Thank you. I'm developing some basic training instructions and this works.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top