This project has moved and is read-only. For the latest updates, please go here.

ActiveSheet.Pictures.Copy

Jul 25, 2012 at 6:43 PM

I'm using the above code in VBA and can't seem to replicate it using the NetOffice.ExcelApi.

Is it possible? This is what I currently have working in VBA.

    Worksheets.Add(After:=Worksheets(Sheets.Count)).Name = "tmpCopy"
    Sheets("Dashboard").Select
    Range("D10:H18").Select
    Selection.Copy
    Sheets("tmpCopy").Select
    ActiveSheet.Pictures.Paste.Select
    Sheets("Dashboard").Select
    Range("J6:N18").Select
    Selection.Copy
    Sheets("tmpCopy").Select
    Range("H1").Select
    ActiveSheet.Pictures.Paste.Select
    ActiveSheet.Pictures.Copy
    Range("A30").Select
    ActiveSheet.Pictures.Paste

It's taking two different cell ranges on the dashboard tab and coping as pics to the tmpCopy tab. Then uses ActiveSheet.Pictures.Paste to select all pictures on that tab to paste into cell "A30" on the same tab.

In a PowerPoint slide I then do a ActiveWindow.View.Paste and works perfectly.

If this doesn't exist in Netoffice can someone guide me on how to do it? I'm currently trying to use range.CopyPicture but the paste operations doesn't apply right, picture all black or variety of other weirdness.

Thanks

-Tom

Jul 25, 2012 at 11:57 PM

the code is 99% compatible in NetOffice 1.5.1

make sure have an import for the globals module in your VB.NET code module and a valid Excel.Application object.

Imports NetOffice.ExcelApi.GlobalHelperModules.GlobalModule

you have to modify the first line of your code:

ActiveWorkbook.Worksheets.Add(Type.Missing, Worksheets(Sheets.Count)).Name = "tmpCopy"

thats all.

Sebastian