Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy a range in excel into paint with vba

Status
Not open for further replies.

Per9922

IS-IT--Management
Oct 1, 2004
74
SE
Hello,

Is it possible to copy a range in excel into paint with vba ? Open and save paint with a name choosen in excel.

Olof
 

Can you do it 'by hand' now?
If so, how do you do it?

Have fun.

---- Andy
 

You said you can do it manually. How do you do it?
Could you write step-by-step how you do it manually?

Have fun.

---- Andy
 
1) Mark cells
2) ctrl-c
3) open paint
4) ctrl-v
 

Believe it or not, I AM trying to help you...

Turn on the Record Macro in Excel,
1) Mark cells
2) ctrl-c
Stop recording.
Look at the VBA code created (Alt-F11)
3) open paint
Look up Shell or ShellExcecute in VBA of how to start another application
Look up SendKeys in VBA help, you may want also see the information about the Clipboard object in VBA help.
4) ctrl-v
SendKeys again, the same may be for saving the file from Paint.

Have fun.

---- Andy
 
:) Okay, I have tried this with no success

Range("F3:J13").Select
Application.CutCopyMode = False
Selection.Copy
Shell "MSpaint", vbMaximizedFocus
Application.SendKeys "^{V}", True
 

That's not enough information: 'no success'.

What did not work? Which line of code was not working?
Did you select and copy the range OK?
Did you start Paint OK?
Did anything work?
I guess you did not paste the info into Paint....

Tek-Tips users will try to help you, but you need to do your job, too. If you have a question, you need to ask it correctly. If you have a problem, you cannot just say “it didn’t work”, you need to tell us where the problem is, which line of code the execution stops at, what the error is (if any), what else did you try, etc.
And I see you did not even check your VBA help in Excel because you would find the correct use of Shell, with en example of code to start the Calculator in there.


Have fun.

---- Andy
 


Also, WHY do you want to paste into MS Paint? Do you then want to manipulate the pixels?

It might have been a better question to ask, "how can I make a Picture from a range in Excel?" because there is a way to do that directly in Excel, without this obtuse round-about method.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Of course the easiest way of copying the spreadsheet as an image to the clipboard is the use of the <PrintScreent> (for full screen) or <ALT><PrintScreen> (for only the active window) and then Pasting into the appropriate program.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top