Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy picture from image control

I have an Excel addin that contains an image control on a userform. When
the addin is run, I would like to copy the picture from the image control to
a worksheet. What I would like to do is ActiveSheet.pictures.add
Image1.Picture, but of course this doesn't work.

Any suggestions?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy picture from image control

Where did the image control get the picture - it is usually from a file -
couldn't you import the image from the file?

--
Regards,
Tom Ogilvy

"Ian" wrote in message
...
I have an Excel addin that contains an image control on a userform. When
the addin is run, I would like to copy the picture from the image control

to
a worksheet. What I would like to do is ActiveSheet.pictures.add
Image1.Picture, but of course this doesn't work.

Any suggestions?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default Copy picture from image control

Hi ,
May be:

Private Declare Function OpenClipboard& _
Lib "user32" (ByVal hwnd As Long)
Private Declare Function EmptyClipboard _
Lib "user32" () As Long
Private Declare Function SetClipboardData& _
Lib "user32" (ByVal wFormat&, ByVal hMem&)
Private Declare Function CloseClipboard& _
Lib "user32" ()
Private Declare Function DestroyIcon& _
Lib "user32" (ByVal hIcon&)

Sub ImageCopy()
Dim iPic As StdPicture, hCopy&
Set iPic = UserForm1.Image1.Picture
OpenClipboard 0&: EmptyClipboard
hCopy = SetClipboardData(2, iPic.handle)
CloseClipboard
If hCopy Then
ActiveSheet.Cells(1, 1).Select
ActiveSheet.Paste
' Save image on disk:
'SavePicture iPic, "c:\Recup.bmp"
End If
DestroyIcon iPic.handle
Set iPic = Nothing
End Sub

Regards,
MP

"Ian" a écrit dans le message de
...
I have an Excel addin that contains an image control on a userform. When
the addin is run, I would like to copy the picture from the image control

to
a worksheet. What I would like to do is ActiveSheet.pictures.add
Image1.Picture, but of course this doesn't work.

Any suggestions?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy picture from image control

Excellent! That is exactly what I needed. Thank you.

"Michel Pierron" wrote in message
...
Hi ,
May be:

Private Declare Function OpenClipboard& _
Lib "user32" (ByVal hwnd As Long)
Private Declare Function EmptyClipboard _
Lib "user32" () As Long
Private Declare Function SetClipboardData& _
Lib "user32" (ByVal wFormat&, ByVal hMem&)
Private Declare Function CloseClipboard& _
Lib "user32" ()
Private Declare Function DestroyIcon& _
Lib "user32" (ByVal hIcon&)

Sub ImageCopy()
Dim iPic As StdPicture, hCopy&
Set iPic = UserForm1.Image1.Picture
OpenClipboard 0&: EmptyClipboard
hCopy = SetClipboardData(2, iPic.handle)
CloseClipboard
If hCopy Then
ActiveSheet.Cells(1, 1).Select
ActiveSheet.Paste
' Save image on disk:
'SavePicture iPic, "c:\Recup.bmp"
End If
DestroyIcon iPic.handle
Set iPic = Nothing
End Sub

Regards,
MP

"Ian" a écrit dans le message de
...
I have an Excel addin that contains an image control on a userform.

When
the addin is run, I would like to copy the picture from the image

control
to
a worksheet. What I would like to do is ActiveSheet.pictures.add
Image1.Picture, but of course this doesn't work.

Any suggestions?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy picture from image control

Yes, but then I would need to distribute the file with the addin, which I
don't want to do.

"Tom Ogilvy" wrote in message
...
Where did the image control get the picture - it is usually from a file -
couldn't you import the image from the file?

--
Regards,
Tom Ogilvy

"Ian" wrote in message
...
I have an Excel addin that contains an image control on a userform.

When
the addin is run, I would like to copy the picture from the image

control
to
a worksheet. What I would like to do is ActiveSheet.pictures.add
Image1.Picture, but of course this doesn't work.

Any suggestions?






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
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook Ruchir Excel Worksheet Functions 1 July 25th 08 07:29 AM
How do copy text from a picture/image & make it available for edi. copy text from image to excel Excel Discussion (Misc queries) 2 March 18th 05 04:35 PM
How to copy text from a picture/image & make it available for edi. Subuu Excel Discussion (Misc queries) 0 March 17th 05 07:11 PM
Displaying a Tif image in the Image Control Neil Excel Programming 1 September 21st 04 12:56 AM
copy shape image into image control Luc Benninger Excel Programming 2 July 15th 04 11:14 AM


All times are GMT +1. The time now is 10:06 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"