Realtreegirl75
New Member
- Joined
- Aug 28, 2022
- Messages
- 40
- Office Version
- 365
- Platform
- Windows
I'm working on a report and I need to have a macro/button that inserts and resizes a picture to a cell and then I need to be able to attach that excel report to an email and send it off.
I have the macro/button to insert each picture and they work perfectly but when I attach the excel document to an email, the picture doesn't show up on the recipients end. When I go though the steps of Insert>Picture>From This Device (pulling from the same location), the picture shows up on the other end every time.
How do I change my macro so that the actual picture is imbedded instead of a link to the file location on my computer? My insert picture macro is below:
Dim fNameAndPath As Variant
Dim img As Picture
fNameAndPath = Application.GetOpenFilename(Title:="Select Picture To Be Imported")
If fNameAndPath = False Then Exit Sub
Set img = ActiveSheet.Pictures.Insert(fNameAndPath)
With img
On Error Resume Next
ActiveSheet.Pictures("A193").Delete
If .Width > .Height Then
.ShapeRange.LockAspectRatio = msoFalse
.Left = ActiveSheet.Range("A193").Left
.Top = ActiveSheet.Range("A193").Top
.Height = ActiveSheet.Range("A193:R203").Height
.Width = ActiveSheet.Range("A193:R203").Width
.Placement = 1
.Name = "A193"
.PrintObject = True
Else
If .Height > .Width Then
.ShapeRange.LockAspectRatio = msoTrue
.Left = ActiveSheet.Range("A193").Left
.Top = ActiveSheet.Range("A193").Top
.Width = ActiveSheet.Range("A193:R203").Width
.Height = ActiveSheet.Range("A193:R203").Height
.Placement = 1
.Name = "A193"
.PrintObject = True
End If
End If
I have the macro/button to insert each picture and they work perfectly but when I attach the excel document to an email, the picture doesn't show up on the recipients end. When I go though the steps of Insert>Picture>From This Device (pulling from the same location), the picture shows up on the other end every time.
How do I change my macro so that the actual picture is imbedded instead of a link to the file location on my computer? My insert picture macro is below:
Dim fNameAndPath As Variant
Dim img As Picture
fNameAndPath = Application.GetOpenFilename(Title:="Select Picture To Be Imported")
If fNameAndPath = False Then Exit Sub
Set img = ActiveSheet.Pictures.Insert(fNameAndPath)
With img
On Error Resume Next
ActiveSheet.Pictures("A193").Delete
If .Width > .Height Then
.ShapeRange.LockAspectRatio = msoFalse
.Left = ActiveSheet.Range("A193").Left
.Top = ActiveSheet.Range("A193").Top
.Height = ActiveSheet.Range("A193:R203").Height
.Width = ActiveSheet.Range("A193:R203").Width
.Placement = 1
.Name = "A193"
.PrintObject = True
Else
If .Height > .Width Then
.ShapeRange.LockAspectRatio = msoTrue
.Left = ActiveSheet.Range("A193").Left
.Top = ActiveSheet.Range("A193").Top
.Width = ActiveSheet.Range("A193:R203").Width
.Height = ActiveSheet.Range("A193:R203").Height
.Placement = 1
.Name = "A193"
.PrintObject = True
End If
End If