Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default save clipboard as wmf

I need a vba macro to save the clipboard contents as wmf file.
does anybody have code for doing this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default save clipboard as wmf

Cannot do the .wmf file because MS Paint will only save a .bmp file
However this macro should give you an idea how to do it with you
application. You will probably have quite a bit of tweaking to do t
get it to work. Save your macro often.

Copy the picture in Excel and run the macro. After opening MSPaint wit
Shell(), it mimics the menu keystrokes required to paste the pictur
from the clipboard, save the file, and close MS Paint.

The macro tends to run too fast so delays have been put in to allo
time for things to happen in Paint as a result of SendKeys, otherwis
Sendkeys tries to send to Excel - often with odd results.

Be patient, and allow time for the macro to complete before doin
anything.

'---------------------------------------------
Sub SavePicture()
Dim MSPaint As String
Dim MyFileName As String
Dim Alt As String
'----------------------------
MyFileName = "Myfile.bmp"
'----------------------------
Alt = "%"
MSPaint = "C:\WINNT\system32\mspaint.exe"
retval = Shell(MSPaint, 1)
'- paste --------------------------
SendKeys Alt & "E", True ' edit
SendKeys "P", True 'paste
Application.Wait Now + TimeValue("00:00:02")
'- save file ------------------------
SendKeys Alt & "F" ' file
Application.Wait Now + TimeValue("00:00:01")
'-
SendKeys "A", True ' saveas
Application.Wait Now + TimeValue("00:00:01")
'-
SendKeys MyFileName, True 'file name
Application.Wait Now + TimeValue("00:00:02")
'-
SendKeys Alt & "S", True
DoEvents
Application.Wait Now + TimeValue("00:00:5")
'- close ----------------------------
SendKeys Alt & "{F4}", True
DoEvents
MsgBox ("File Saved.")
End Sub
'-- eop --------------------------------------

--
Message posted from http://www.ExcelForum.com

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
Where does Ms XL store the clipboard ? or where does MS Windowsstore clipboard ? Subu Setting up and Configuration of Excel 1 May 18th 09 06:56 AM
Clipboard empty but still get waring that clipboard is full Steve Excel Discussion (Misc queries) 0 June 17th 08 09:05 PM
How do I save the items listed on the clipboard? levi Excel Discussion (Misc queries) 1 October 28th 06 06:29 PM
How do I save the items listed on the clipboard? levi New Users to Excel 1 October 27th 06 10:21 PM
Is it possible to save work on the clipboard and reuse ? nina Excel Worksheet Functions 1 January 18th 06 05:44 AM


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