Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Using pictures in Userforms

Hi there,
until recently used Message Boxes to give the user information. However as
of right now I need to give more information and the upkeep in the current
format requires me to change the code so that the apearance is uniform.

I have tables in a seperate worksheet which I managed to turn into pictures.
I intend to load them on userforms which will pop-up after double-clicks.(The
tables will change dynamicly so copy and paste in the properties window of a
image won't work I guess)

My question is how do I load them from the worksheet into a Userform? Do I
need to export them first and then import them back? Or do I even need
Userforms in the first place can I display pictures in Msg Boxes?

Thank you,
Ozgur
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Using pictures in Userforms

Put this macro into a module:

Sub example()
ActiveChart.Export "temp.jpg", "JPG", True
UserForm1.Show
On Error Resume Next
Unload UserForm1
Kill "temp.jpg"
On Error GoTo 0
End Sub


Then, in your Userform (e.g. UserForm1), create an image control (e.g.
called "Image1"), and a command button called "CommandButton1"). Set the
Autosize property of the image control to true.

Place the code below into the form.

Private Sub UserForm_Activate()
Image1.Picture = LoadPicture("temp.jpg")
End Sub

Private Sub CommandButton1_Click()
Me.Hide
End Sub


With a chart selected, run the macro "example".

I also put a sample file in my web site:
http://www.vonixx.com/excel/chart_in_form.xls

Regards,
Edwin Tam

http://www.vonixx.com




"Ozgur Pars" wrote:

Hi there,
until recently used Message Boxes to give the user information. However as
of right now I need to give more information and the upkeep in the current
format requires me to change the code so that the apearance is uniform.

I have tables in a seperate worksheet which I managed to turn into pictures.
I intend to load them on userforms which will pop-up after double-clicks.(The
tables will change dynamicly so copy and paste in the properties window of a
image won't work I guess)

My question is how do I load them from the worksheet into a Userform? Do I
need to export them first and then import them back? Or do I even need
Userforms in the first place can I display pictures in Msg Boxes?

Thank you,
Ozgur

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Using pictures in Userforms

Edwin thank you for your response.
I did copy your code into a module and userform and it works great with a
chart. However I was wondering if I can do the same export with a picture(I
have a range of cells saved as a picture)?
This does not work...
ActiveSheet.Shapes("Picture 1").Export "temp.jpg", "JPG", True

Any thoughts?

Thanks again for your help.

Özgür
"Edwin Tam" wrote:

Put this macro into a module:

Sub example()
ActiveChart.Export "temp.jpg", "JPG", True
UserForm1.Show
On Error Resume Next
Unload UserForm1
Kill "temp.jpg"
On Error GoTo 0
End Sub


Then, in your Userform (e.g. UserForm1), create an image control (e.g.
called "Image1"), and a command button called "CommandButton1"). Set the
Autosize property of the image control to true.

Place the code below into the form.

Private Sub UserForm_Activate()
Image1.Picture = LoadPicture("temp.jpg")
End Sub

Private Sub CommandButton1_Click()
Me.Hide
End Sub


With a chart selected, run the macro "example".

I also put a sample file in my web site:
http://www.vonixx.com/excel/chart_in_form.xls

Regards,
Edwin Tam

http://www.vonixx.com




"Ozgur Pars" wrote:

Hi there,
until recently used Message Boxes to give the user information. However as
of right now I need to give more information and the upkeep in the current
format requires me to change the code so that the apearance is uniform.

I have tables in a seperate worksheet which I managed to turn into pictures.
I intend to load them on userforms which will pop-up after double-clicks.(The
tables will change dynamicly so copy and paste in the properties window of a
image won't work I guess)

My question is how do I load them from the worksheet into a Userform? Do I
need to export them first and then import them back? Or do I even need
Userforms in the first place can I display pictures in Msg Boxes?

Thank you,
Ozgur

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you export pictures from my pictures file into a word docu Becky New Users to Excel 1 November 20th 09 07:02 PM
Storing Clip Art pictures in My Pictures folder jfg Excel Discussion (Misc queries) 4 August 10th 07 06:12 AM
Excel's Compress Pictures or deleting pictures doesn't seem work guidod Excel Discussion (Misc queries) 1 January 29th 06 06:51 AM
userforms Fretsa Excel Programming 1 July 27th 04 12:52 AM
userforms Jo[_4_] Excel Programming 2 September 17th 03 10:35 PM


All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"