Logo doesn't copy as part of a VBA routine

kgkev

Well-known Member
Joined
Jun 24, 2008
Messages
1,291
Office Version
  1. 365
Platform
  1. Windows
I have a company logo at the top of the sheet I am trying to copy.

However it doesn't copy across to my new book?

Code:
Application.Workbooks.Open ("\\ih-serv\company\Shipping\Invoices\Excel\" & invnum & ".xls")
            'Workbooks(invnum).Sheets("invoice EDIT").Range("A1:W402").Copy
            Workbooks(invnum).Sheets("invoice EDIT").Cells.Copy
            Workbooks("invoice").Activate
            Sheets("invoice EDIT").Activate
            Range("A1").Activate
            
            ActiveCell.PasteSpecial xlPasteAll
            
            Application.CutCopyMode = False
            
            Workbooks(invnum).Close

any idea why?
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Your logo is a Shape, and isn't part of the cells you are copying. Try something like this:

Code:
Workbooks(invnum).Sheets("invoice EDIT").Shapes(1).Copy
ActiveCell.PasteSpecial xlPasteAll
 
Upvote 0
It may be easier to just copy the whole worksheet.

Code:
    Dim wbInv As Workbook, wbInvnum As Workbook
    
    'invnum = ???
    
    Application.ScreenUpdating = False
    
    Set wbInv = Workbooks("invoice")
    
    Set wbInvnum = Workbooks.Open("\\ih-serv\company\Shipping\Invoices\Excel\" & invnum & ".xls")
    
    wbInvnum.Sheets("invoice EDIT").Copy After:=wbInv.Sheets(wbInv.Sheets.Count)
    
    wbInvnum.Close SaveChanges:=False
    
    Application.ScreenUpdating = True
 
Upvote 0
It may be easier to just copy the whole worksheet.

Code:
    Dim wbInv As Workbook, wbInvnum As Workbook
    
    'invnum = ???
    
    Application.ScreenUpdating = False
    
    Set wbInv = Workbooks("invoice")
    
    Set wbInvnum = Workbooks.Open("\\ih-serv\company\Shipping\Invoices\Excel\" & invnum & ".xls")
    
    wbInvnum.Sheets("invoice EDIT").Copy After:=wbInv.Sheets(wbInv.Sheets.Count)
    
    wbInvnum.Close SaveChanges:=False
    
    Application.ScreenUpdating = True


This works OK on excel 2010. I have added the need to delete the original "invoice EDIT"

however Set wbInv = Workbooks("invoice") failed on excel 2000
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top