Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Clipboard images to Bitmap files through VBA in Excel

This is an 'older' question (in that I know it's been asked before, but I'm
not sure anyone has ever answered it). Specifically I'm looking for a
workbook example that allows a user to take whatever has most recently been
copied into the clipboard and save that as a BMP image (ie. with a .bmp
extension, not jpeg or gif or png formatted) using VBA.

Lebans has some older code posted on-line, but I can't get it to work. It
might be that I haven't added all the necessary references, but I am
including the OLE reference that he suggests - again no dice.

Please assist,
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Clipboard images to Bitmap files through VBA in Excel

Everything you need is in Stephen Bullen's PastePicture.Zip here

http://www.oaltd.co.uk/Excel/Default.htm

Regards,
Peter T


"Elliot" wrote in message
...
This is an 'older' question (in that I know it's been asked before, but
I'm
not sure anyone has ever answered it). Specifically I'm looking for a
workbook example that allows a user to take whatever has most recently
been
copied into the clipboard and save that as a BMP image (ie. with a .bmp
extension, not jpeg or gif or png formatted) using VBA.

Lebans has some older code posted on-line, but I can't get it to work. It
might be that I haven't added all the necessary references, but I am
including the OLE reference that he suggests - again no dice.

Please assist,
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Clipboard images to Bitmap files through VBA in Excel

Doesn't seem to be working in Excel 2007 (ok in 2003, but I don't get any
result returned for oPic - Paste Picture function doesn't seem to be working
in 2007).



"Peter T" wrote:

Everything you need is in Stephen Bullen's PastePicture.Zip here

http://www.oaltd.co.uk/Excel/Default.htm

Regards,
Peter T


"Elliot" wrote in message
...
This is an 'older' question (in that I know it's been asked before, but
I'm
not sure anyone has ever answered it). Specifically I'm looking for a
workbook example that allows a user to take whatever has most recently
been
copied into the clipboard and save that as a BMP image (ie. with a .bmp
extension, not jpeg or gif or png formatted) using VBA.

Lebans has some older code posted on-line, but I can't get it to work. It
might be that I haven't added all the necessary references, but I am
including the OLE reference that he suggests - again no dice.

Please assist,
Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Clipboard images to Bitmap files through VBA in Excel

I meant for you to extract the relavant APIs and code and adapt for your
needs.

Drag modPastePicture from PastePicture.xls into your project, add another
module with the following

' Save image in the clipboard (if any)
' requires modPastePicture from Stephen Bullen's PastePicture.xls
' to test press (Alt or Ctrl) PrtScn before running
Sub SaveClipboardBMP()
Dim vFile As Variant
Dim sFilter As String, lPicType As Long
Dim oPic As IPictureDisp

On Error Resume Next
Set oPic = PastePicture(xlBitmap)
On Error GoTo 0

If oPic Is Nothing Then
MsgBox "no image in clipboard"
Else
sFilter = "Windows Bitmap (*.bmp),*.bmp"
vFile = Application.GetSaveAsFilename( _
initialfilename:="", filefilter:=sFilter)
If vFile < False Then
SavePicture oPic, vFile
End If
End If
End Sub

Regards,
Peter T


"Elliot" wrote in message
...
Doesn't seem to be working in Excel 2007 (ok in 2003, but I don't get any
result returned for oPic - Paste Picture function doesn't seem to be
working
in 2007).



"Peter T" wrote:

Everything you need is in Stephen Bullen's PastePicture.Zip here

http://www.oaltd.co.uk/Excel/Default.htm

Regards,
Peter T


"Elliot" wrote in message
...
This is an 'older' question (in that I know it's been asked before, but
I'm
not sure anyone has ever answered it). Specifically I'm looking for a
workbook example that allows a user to take whatever has most recently
been
copied into the clipboard and save that as a BMP image (ie. with a .bmp
extension, not jpeg or gif or png formatted) using VBA.

Lebans has some older code posted on-line, but I can't get it to work.
It
might be that I haven't added all the necessary references, but I am
including the OLE reference that he suggests - again no dice.

Please assist,
Thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
j j is offline
external usenet poster
 
Posts: 128
Default Clipboard images to Bitmap files through VBA in Excel

Hi Elliot

did you find a solution for this? I get similar issues when using Win API
Clipboard method GetClipboardData - there are no BMP types on the Windows
clipboard (enum=2) following Paste of any kind from VBA?

cheers!



"Elliot" wrote:

Doesn't seem to be working in Excel 2007 (ok in 2003, but I don't get any
result returned for oPic - Paste Picture function doesn't seem to be working
in 2007).



"Peter T" wrote:

Everything you need is in Stephen Bullen's PastePicture.Zip here

http://www.oaltd.co.uk/Excel/Default.htm

Regards,
Peter T


"Elliot" wrote in message
...
This is an 'older' question (in that I know it's been asked before, but
I'm
not sure anyone has ever answered it). Specifically I'm looking for a
workbook example that allows a user to take whatever has most recently
been
copied into the clipboard and save that as a BMP image (ie. with a .bmp
extension, not jpeg or gif or png formatted) using VBA.

Lebans has some older code posted on-line, but I can't get it to work. It
might be that I haven't added all the necessary references, but I am
including the OLE reference that he suggests - again no dice.

Please assist,
Thanks




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
Transfer clipboard from Task pane clipboard(office?) content to Excel (windows?) clipboard? tskogstrom Excel Programming 2 March 6th 07 12:50 PM
Linking Excel Reports to Bitmap Files RBetke Excel Discussion (Misc queries) 0 June 7th 06 04:08 AM
how i convert excel files with images to access mike Excel Discussion (Misc queries) 1 March 7th 05 05:51 PM
Storing Bitmap Images (Drawing Objects) in an Add-In Frank & Pam Hayes[_2_] Excel Programming 9 September 21st 04 11:30 AM
loading a bitmap into an image control from the clipboard Loane Sharp Excel Programming 4 February 29th 04 01:49 PM


All times are GMT +1. The time now is 02:36 AM.

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

About Us

"It's about Microsoft Excel"