I am using Ron de Bruin's script (modified version) to filter and email a list using Outlook. The files are sent as xlsx extensions in the email.
The original excel sheet contains URL hyperlinks. However, when it is filtered and copied to a new workbook to attach, those hyperlinks are not retained.
But when I copy and paste the column of URLS to the email attachment, the hyperlinks work. So this is the section where it is not working.
I even added a
The original excel sheet contains URL hyperlinks. However, when it is filtered and copied to a new workbook to attach, those hyperlinks are not retained.
But when I copy and paste the column of URLS to the email attachment, the hyperlinks work. So this is the section where it is not working.
I even added a
VBA Code:
Dim Hlink As Hyperlink
VBA Code:
Set My_Range = Worksheets("Sheet1").Range("$a$4:$M20") '(How Do I change M20 to &lastrow that works?)
My_Range.Parent.Select
NewTab ("sheet2")
Worksheets("sheet2").Cells.ClearContents
My_Range.Copy Destination:=Worksheets("sheet2").Range("$A$4:M20")
For Each Hlink In My_Range.Hyperlinks
Worksheets("sheet2").Hyperlinks.Add Anchor:=Hlink.Range, Address:=Hlink.Address, TextToDisplay:=Hlink.TextToDisplay
Next Hlink
Sheets("sheet2").Select
Sheets("sheet2").Move
With Selection.Font
.Name = "Calibri"
.Size = 7.5
End With
tempFilename = TempFilePath & File & ".xlsx"
ActiveWorkbook.SaveAs FileName:=tempFilename, _
FileFormat:=xlOpenXMLWorkbook
Workbooks(File & ".xlsx").Close