Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Where does Ms XL store the clipboard ? or where does MS Windowsstore clipboard ? | Setting up and Configuration of Excel | |||
Clipboard empty but still get waring that clipboard is full | Excel Discussion (Misc queries) | |||
How do I save the items listed on the clipboard? | Excel Discussion (Misc queries) | |||
How do I save the items listed on the clipboard? | New Users to Excel | |||
Is it possible to save work on the clipboard and reuse ? | Excel Worksheet Functions |