Akshay07 Posted November 18, 2009 Share Posted November 18, 2009 I had a look in many of the _Excel functions, and I cannot find how to paste an image in Excel. I could use some help Link to comment Share on other sites More sharing options...
Juvigy Posted November 19, 2009 Share Posted November 19, 2009 $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open ($filename1) $oExcel.Application.ActiveSheet.Paste Try this , i havent tested it but it should work. Link to comment Share on other sites More sharing options...
Akshay07 Posted November 19, 2009 Author Share Posted November 19, 2009 $oExcel = ObjCreate("Excel.Application") $oExcel.Visible = 1 $oExcel.WorkBooks.Open ($filename1) $oExcel.Application.ActiveSheet.Paste Try this , i havent tested it but it should work. Thanks. Unfortunately, it doesn't work. "Error: The requested action with this object has failed" I also need to paste a picture into a specific cell. Link to comment Share on other sites More sharing options...
Juvigy Posted November 19, 2009 Share Posted November 19, 2009 Does it work when doing it manually? For the current cell try something like $oExcel.Application.ActiveSheet.Range("B5").Sellect ; sellects B5 $oExcel.Application.ActiveSheet.CurrentCell.Paste Also i hope you copied the picture before executing the script? Link to comment Share on other sites More sharing options...
Akshay07 Posted November 19, 2009 Author Share Posted November 19, 2009 Does it work when doing it manually?For the current cell try something like$oExcel.Application.ActiveSheet.Range("B5").Sellect ; sellects B5$oExcel.Application.ActiveSheet.CurrentCell.PasteAlso i hope you copied the picture before executing the script?Thanks for the tip for the cell selection. I think I know where the problem is. I am trying to copy a "small" window and then paste the image by simulating ALT and PRINTSCREEN key combination. But what is actually done is ALT, and then PRINTSCREEN, and as the image is then way too large, I can't paste it into excel.So I need to check how to simulate ALT and PRINTSCREEN at the same time, or look into the help if a function allows an image capture of a specific window. Link to comment Share on other sites More sharing options...
Akshay07 Posted November 19, 2009 Author Share Posted November 19, 2009 (edited) For some reasons, the paste function works with Send("^v") but not with $oExcel.Application.ActiveSheet.CurrentCell.Paste Edited November 19, 2009 by Akshay07 Link to comment Share on other sites More sharing options...
Juvigy Posted November 20, 2009 Share Posted November 20, 2009 Try this : $oExcel.Application.ActiveSheet.Paste It doesnt paste the pic in the cell , though. Link to comment Share on other sites More sharing options...
Akshay07 Posted December 4, 2009 Author Share Posted December 4, 2009 Thanks, but the goal is to past the image in a specific cell. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now