Jump to content

Paste an image in Excel


Akshay07
 Share

Recommended Posts

$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

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

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?

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

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...