Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
How do copy text from a picture/image & make it available for edi. | Excel Discussion (Misc queries) | |||
How to copy text from a picture/image & make it available for edi. | Excel Discussion (Misc queries) | |||
Displaying a Tif image in the Image Control | Excel Programming | |||
copy shape image into image control | Excel Programming |