ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display AutoShape in UserForm (https://www.excelbanter.com/excel-programming/344606-display-autoshape-userform.html)

bforster1[_28_]

Display AutoShape in UserForm
 

I am trying to have AutoShapes displayed, specifically a green up arrow
and red down arrrow, in a UserForm based on certain conditions. Any
suggestions. Here is what I tried;

Private Sub UserForm_Initialize()
TextBox1.Object = AutoShape27
End Sub

Does not work.

Please help.


--
bforster1
------------------------------------------------------------------------
bforster1's Profile: http://www.excelforum.com/member.php...o&userid=11771
View this thread: http://www.excelforum.com/showthread...hreadid=481825


K Dales[_2_]

Display AutoShape in UserForm
 
Userforms use the MSForms objects and so they don't natively support
autoshapes. But you can insert an image control and then (either manually at
setup time or through code) specify the picture to go in the image control.
So if you make two picture files for your arrows you should be able to
display them on the userform, something like this with the proper
substitutions:

If {whatever your condition is} Then _
UserForm1.Image1.Picture = LoadPicture("C:\GreenArrow.bmp") Else _
UserForm1.Image1.Picture = LoadPicture("C:\RedArrow.bmp")
--
- K Dales


"bforster1" wrote:


I am trying to have AutoShapes displayed, specifically a green up arrow
and red down arrrow, in a UserForm based on certain conditions. Any
suggestions. Here is what I tried;

Private Sub UserForm_Initialize()
TextBox1.Object = AutoShape27
End Sub

Does not work.

Please help.


--
bforster1
------------------------------------------------------------------------
bforster1's Profile: http://www.excelforum.com/member.php...o&userid=11771
View this thread: http://www.excelforum.com/showthread...hreadid=481825




All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com