• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

BACKUP LINK|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / BACKUP LINK|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosBACKUP LINK
sp_PrintTopic sp_TopicIcon
BACKUP LINK
Avatar
Jose Zavala
Member
Members
Level 0
Forum Posts: 41
Member Since:
October 25, 2017
sp_UserOfflineSmall Offline
1
November 7, 2021 - 7:45 am
sp_Permalink sp_Print sp_EditHistory

have the code below which works good, this one add the link for the spreadsheet on body of the email to click to open, how can I modify it that it can also add the link of the backup that is pdf format located in the same folder.

 

Hi,

have the code below which works good, this one add the link for the EFT spreadsheet on body of the email to click to open, how can I modify it that it can also add the link of the backup that is pdf format located in the same folder.

Here the code:

VBA Code:
Sub Make_Outlook_Mail_With_File_Link()
'Working in Excel 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

If ActiveWorkbook.Path <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

strbody = "" & _
"Hi Afia,

" & _
"
" & _
ActiveWorkbook.Name & " is created.
" & _
"Please click on this link to open the file : " & _
" & ActiveWorkbook.FullName & _
""">Link to the file" & _

"

Note: The EFT backup link is on the spreadsheet...." & _
"

Thank you," & _
"

"

On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "RE: " & Range("SUBJECT").Value 'ActiveWorkbook.Name
.HTMLBody = strbody
.Display 'or use .Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "The ActiveWorkbook does not have a path, Save the file first."
End If
End Sub

Thank you

 

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
November 9, 2021 - 2:06 pm
sp_Permalink sp_Print

Hi Jose,

You have to use the href tag:

"<a href=""" & LinkHere & """>" & ActiveWorkbook.FullName & "</a>"

Are you sure you want to send a local file path to another user? On that computer, the user might not have the same path.

Avatar
Jose Zavala
Member
Members
Level 0
Forum Posts: 41
Member Since:
October 25, 2017
sp_UserOfflineSmall Offline
3
November 10, 2021 - 2:05 am
sp_Permalink sp_Print

Hi Catalina,

Yes, spreadsheet working fine when sending I am not using letter mapping instead pointing only to the  network path shared folder and they're able to open it.  Just want to add the link to the backup for the EFT in the same email as well.

 

Is there another way to do it instead of href tag?

 

Thank you for your response.

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
4
November 10, 2021 - 5:25 am
sp_Permalink sp_Print

According to HTML language, that's the way to create a hyperlink:

https://www.w3schools.com/html....._links.asp

It's the only way.

Avatar
Jose Zavala
Member
Members
Level 0
Forum Posts: 41
Member Since:
October 25, 2017
sp_UserOfflineSmall Offline
5
November 11, 2021 - 4:26 am
sp_Permalink sp_Print sp_EditHistory

thank you Catalin.

If I have pdf hyperlink (complete address path)backup in cell C6 adding this line to the VBA code above

 

"<A href=" & Sht.Range("C6") & ">" & Sht.Range("C6") & "</A>" &

 

Will this work?

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
6
November 11, 2021 - 1:58 pm
sp_Permalink sp_Print

No, will not work.

Why don't you use the example I sent? your double quotes are not properly added, already gave you the correct string:

"<a href=""" & Sht.Range("C6") & """>" & Sht.Range("C6") & "</a>"

The href link must be enclosed between double quotes, if you print your string in immediate window you will see that it has no double quotes.

Avatar
Jose Zavala
Member
Members
Level 0
Forum Posts: 41
Member Since:
October 25, 2017
sp_UserOfflineSmall Offline
7
November 12, 2021 - 2:26 am
sp_Permalink sp_Print

Thank you so much.

Avatar
Jose Zavala
Member
Members
Level 0
Forum Posts: 41
Member Since:
October 25, 2017
sp_UserOfflineSmall Offline
8
November 18, 2021 - 7:09 am
sp_Permalink sp_Print

Hi Catalin,

I did as you suggested and here is the code modified, the only problem the pdf backup will no pointo the folder path,  the Cell "E3" is the hyperlink to the pdf file, no sure how can make it to work:

 

here is the code:

 

Sub Make_Outlook_Mail_With_File_Link()
'Working in Excel 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

If ActiveWorkbook.Path <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

strbody = "<font size=""3"" face=""Calibri"">" & _
"Hi ,<br><br>" & _
"<br><B>" & _
ActiveWorkbook.Name & "</B> is created.<br>" & _
"Please click on this link to open the file : " & _
"<A HREF=""file://" & ActiveWorkbook.FullName & _
""">Link to the file</A>" & "</B> <br> <br>" & _
"PDF BACKUP" & "</B> is saved.<br>" & _
"<A HREF=""file://" & ActiveWorkbook.ActiveSheet.Range("E3") & _
""">Link to the file</A>" & _
"<br><br>Note: The EFT backup link is on the spreadsheet as well...." & _
"<br><br>Thank you," & _
"<br><br></font>"

On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "RE: " & Range("SUBJECT").Value 'ActiveWorkbook.Name
.HTMLBody = strbody
.Display 'or use .Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "The ActiveWorkbook does not have a path, Save the file first."
End If

End Sub

When click works good and shows this in outlook:

Hi ,

Primus Batch EFT...Nov 162.xlsm is created.
Please click on this link to open the file : Link to the file

PDF BACKUP is saved.
Link to the file  ...............But this will not work when click to follow shows this:  file://325 1-10 primus ra-jr.pdf no the complete network shared folder.

 

Thank you,

 

thank you,

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1807
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
9
November 18, 2021 - 2:29 pm
sp_Permalink sp_Print

Put the full path in E3, not just the file name.

Or, put the network folder address in code before E3 value:

NetworkPath & ActiveWorkbook.ActiveSheet.Range("E3")

Avatar
Jose Zavala
Member
Members
Level 0
Forum Posts: 41
Member Since:
October 25, 2017
sp_UserOfflineSmall Offline
10
November 19, 2021 - 9:44 am
sp_Permalink sp_Print

Thank you very much for your help, worked perfectly your suggestion.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Ray-Yu Yang
George Shihadeh
Naomi Rumble
Uwe von Gostomski
Jonathan Jones
drsven
Forum Stats:
Groups: 3
Forums: 24
Topics: 6212
Posts: 27236

 

Member Stats:
Guest Posters: 49
Members: 31888
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.