Jump to content

Recommended Posts

Posted

$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.

Posted

  On 11/19/2009 at 7:26 AM, 'Juvigy said:

$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.

Posted

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?

Posted

  On 11/19/2009 at 11:51 AM, 'Juvigy said:

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.

Posted (edited)

For some reasons, the paste function works with

Send("^v")

but not with

$oExcel.Application.ActiveSheet.CurrentCell.Paste

Edited by Akshay07
  • 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
  • Recently Browsing   0 members

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