Jeffrey Mahoney
Well-known Member
- Joined
- May 31, 2015
- Messages
- 2,773
- Office Version
- 365
- Platform
- Windows
I can't believe this is not easier for me. I looked at many posts and tried to duplicate their results. When I manually copy a range as a picture, paste it, and Save as Picture, it seems so easy. I even used some code that first pasted the picture into a chart, but I get an empty file after exporting.
Please help with the code to export a shape into a TIF file.
Please help with the code to export a shape into a TIF file.
VBA Code:
Sub SaveRangeToFile()
Dim MatNum As String
Dim FileName As String
Dim Shp As Shape
Dim Sht As Worksheet
Set Sht = ActiveSheet
Range("SaveRange").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
MatNum = Range("MaterialNum").Value
FileName = MatNum & ".tif"
Range("P4").Select
Sht.Pictures.Paste.Select
Set Shp = Sht.Shapes(Sht.Shapes.Count)
Shp.Export FileName:=FileName, Filtername:="TIF" '<<<<< There is no option to export a shape
End Sub