When copying Excel sheet to a new workbook, images are not being copied VBA

Bellatrix461

New Member
Joined
Sep 7, 2020
Messages
4
Platform
  1. Windows
Hello all,
I have created the VBA code to copy an Excel sheet to a new workbook in .xlsx format as I need the new workbook to be free of macros. However, the sheet I'm copying has the company's logo and I need it to be on the new workbook as well. However, is not doing it.

The code I'm using to copy the sheet to a new workbook is:

Sub SaveAsName()

Sheets("WWW").Copy
ActiveWorkbook.SaveAs Filename:="TEST FILE " & Range("G13") & ".xlsx"
Application.DisplayAlerts = False

End Sub

You may see attached a screenshot on how it looks the original file and the new workbook after running the macro. The "New" button should not be included in the new workbook (which is ok now because is not showing) but the logo (called Picture_6) it should.

Thank you for all your help!
 

Attachments

  • After running macro file.JPG
    After running macro file.JPG
    53.1 KB · Views: 3
  • Original file.JPG
    Original file.JPG
    64 KB · Views: 3

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,593
Office Version
  1. 2007
Platform
  1. Windows
Hi and welcome to MrExcel.

Try this:

VBA Code:
Sub SaveAsName()
  Application.CopyObjectsWithCells = True
  Sheets("WWW").Copy
  ActiveSheet.DrawingObjects("New").Delete
  ActiveWorkbook.SaveAs Filename:="TEST FILE " & Range("G13") & ".xlsx"
    Application.DisplayAlerts = False
End Sub
 

Bellatrix461

New Member
Joined
Sep 7, 2020
Messages
4
Platform
  1. Windows
Hi and welcome to MrExcel.

Try this:

VBA Code:
Sub SaveAsName()
  Application.CopyObjectsWithCells = True
  Sheets("WWW").Copy
  ActiveSheet.DrawingObjects("New").Delete
  ActiveWorkbook.SaveAs Filename:="TEST FILE " & Range("G13") & ".xlsx"
    Application.DisplayAlerts = False
End Sub


Thank you so much,@DanteAmor !! This worked perfectly! :D
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,593
Office Version
  1. 2007
Platform
  1. Windows
I'm glad to help you. Thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,520
Messages
5,548,532
Members
410,845
Latest member
OldSwimmer1650
Top