VBA Help Required - Copy / paste text and photos to new file maintaining aspect ratio

NeoSez

Board Regular
Joined
Aug 14, 2020
Messages
210
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I have a file that I am trying to send out as it cycles through a contact list specific to that contact.

I have some photos that are in my excel sheet. However, when I copy the photos to the new file, the photos are distorted and the height is incorrect. The width is correct. I would like all the photos to be 1.5" in height and to maintain the aspect ratio.



VBA Code:
Set My_Range = Range("A1:G1000")
My_Range.Copy
Sheets("SHEET1").Range("A1").PasteSpecial xlPasteAll
Application.CutCopyMode = False

'Insert Today's Date
Range("H1").Value = Date



I also tried this code, but it also had distorted images.

VBA Code:
tempFilename = TempFilePath & File & ".xlsx"
ActiveWorkbook.SaveAs FileName:=tempFilename, _
    FileFormat:=xlOpenXMLWorkbook
Workbooks(File & ".xlsx").Close





The text and photos are in column E and the photos are associated with the contacts in column "F". It will email only the photos associated with that contact to that specific contact.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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