+ Reply to Thread
Results 1 to 28 of 28

Hyperlink disappearing when certain conditions are met

  1. #1
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Hyperlink disappearing when certain conditions are met

    Hello, I am using a hyperlink formula to create a hyperlink to send an email to an email address that is specified in another cell. The email also pulls information from other cells to put into the body of the email, but the "Generate Email" hyperlink I created seems to be disappearing when the person it is sending the email to reaches 6 pulled values that must be put into the body (It works fine for 5, but when I enter data into the 6th cell the hyperlink disappears completely and will not let me click it, though the cell still shows the formula when its selected. I have attached a copy of the formula I am using.
    =IFERROR(HYPERLINK("mailto:" & $M2 & "?subject=360 Reviews" & "&body=Hello "&VLOOKUP($L2,$H$1:$J$102,3,FALSE)&","&"%0A%0AYou have been chosen to be a 360 Reviewer for the following employee(s):%0A%0A"&UniqueListTranspose!$B2
    &"%0A"&UniqueListTranspose!$C2 &"%0A"&UniqueListTranspose!$D2 &"%0A"&UniqueListTranspose!$E2 &"%0A"&UniqueListTranspose!$F2 &"%0A"&UniqueListTranspose!$G2 &"%0A"&UniqueListTranspose!$H2 &"%0A"&UniqueListTranspose!$I2 &"%0A"&UniqueListTranspose!$J2 &"%0A"&UniqueListTranspose!$K2, "Generate Email"),"")
    EDIT* I've just discovered another interesting problem with this. When I add more cells to reference in my formula (For example, above is B2-K2 in sheet UniqueListTranspose), such as expanding from B2-Z2, I am only allowed 1 value to be pulled, a second breaks the hyperlink. Similarly, B2-Q2 allows for 3 values before breaking when a 4th value is added. This is extremely counter intuitive as I need to be able to reference roughly 30 cells in the formula to return all of that data in the email, but the more cells I attempt to call to in my formula, the fewer I can actually have it return.
    Last edited by xAcrosonicx; 08-07-2019 at 04:17 PM.

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    There is a limit to the length of a hyperlink formula, I can't remember what it is offhand.

    Last time I suggested vba to replace the hyperlink formula with a text string and a proper hyperlink.

    I'll see if I can find the last thread where this happened.

    edit:- this was the thread, but the OP didn't return to confirm if it worked or not, this was for opening the link in a browser so will probably need some changes to do what you need.

    If this is an option that you can use then we can look into modifying it to fit your requirement.
    Last edited by jason.b75; 08-07-2019 at 04:31 PM.

  3. #3
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Hi Jason, thanks for the reply! I'm not seeing the link to the other thread, but it's very interesting that there is such a small limit.

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Oops, I forgot to paste the link

    https://www.excelforum.com/excel-for...rl-limits.html

    Not sure why the limit is still so low, a 255 character limit was a common factor with other things at one point, but most have been increased now.

  5. #5
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Hey Jason,

    Does this work for a formula that is referencing a multitude of cells? For example, I have people changing the contents of a table, and then the link should update with what those cells contain now, thus altering the mailto hyperlink body contents.

    Here's what I want it to do:
    1. Pull the email address from M2
    2. Create the subject "360 Reviews"
    3. Create the body as follows
    Line 1: Hello (add name pulled from vlookup that checks the email address we are sending it to, and the associated first name. This comes from range H2:J102 and the return column is 3),
    Line 2: Line break
    Line 3: You have been chosen to review the following employees:
    Line 4: Line break
    Line 5: Values in Sheet3 cells A2:CC2 - with a line break following each cell value (For example, line 5 would be cell A2, but B2 would be on the next line and so on)

    The tricky part is that I am essentially looking for this to create a button next to each employees name, so that I can click it and it will generate an email to that employee. In other words, I was trying to create a formula and drag it down 115 cells so that each person would have a unique button, I'm not sure if this is possible with VBA - maybe one "button" could send an email to all of them?

    If possible, I would also like to add my default signature to the email (I'm using outlook)
    Last edited by xAcrosonicx; 08-08-2019 at 10:34 AM.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Giving it some more thought, I would look at breaking it down with this formula to generate the body (formula simplified for excel 2019, older versions don't support the TEXTJOIN function), then use vba to insert the components separately.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then some code like this edited version of original taken from Ron de Bruin's site, see link for original code. https://www.rondebruin.nl/win/s1/outlook/bmail5.htm

    Please note that I have not been able to test this code as I don't have outlook installed. I'll do what I can to help you with this, but not being able to test will limit my ability.

    This code uses a loop to cycle through the contents of column M and compose a message to send to each email address listed.

    Assigning this code to a button will bypass the need for a hyperlink in the cell.

    Please Login or Register  to view this content.
    There are 3 lines of code that I've highlighted in red above, the first is for testing and will need to be removed to work properly, replacing it with the commented out line above it. This is done so that it only runs 2 email addresses for testing instead of the entire list.
    The second will need changing based on the location of the formula in relation to column M, the current setting assumes that the formula wil lbe located in column N.
    The third only shows the created message on screen, .Display needs to be changed to .Send to fully automate the process.

    Hope this helps.

  7. #7
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    I have copied the formula you suggested into cell N2 (immediate right of cell M as you referenced in your comment) and created a macro with the above code. I removed the first red highlight and used the commented out line in place of it. Since I placed the suggested formula in cell N, I left the second highlighted line as is. I also left the third for this testing phase. Unfortunately the result is that cell N2 now displays the text displayed in the formula, as well as the data from the cell that the formula references. When I run the macro, nothing happens. I tried clicking on cell N2 as well and it did nothing.

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Quote Originally Posted by JakePetersen View Post
    Unfortunately the result is that cell N2 now displays the text displayed in the formula, as well as the data from the cell that the formula references.
    The formula as provided, should display the body text of the email, the mailto: email address and subject are created separately.

    From what you have said above, it looks like you tried to use it with the hyperlink formula, as I said in my previous reply,
    Assigning this code to a button will bypass the need for a hyperlink in the cell.
    in fact, if you have tried to add a hyperlink, that is quite likely why it is not working, although it should still have attempted to create a message when you ran the code.

    To add a 'button' to a sheet, you either use a 'Shape' from the 'Insert' tab on the ribbon, or a button from the 'Insert' toolbox on the 'Developer' tab (if available).

    To run it without a button, go to the 'View' tab, then 'Macros'.

    When you run it, do you get any error messages pop up?

  9. #9
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Hey Jason,

    I really appreciate all your help so far! I am not using it with hyperlink, so I'm not sure why it isn't running. The odd thing is that I created a quick new book to see if it would run in there, and it did! So I'm not really sure what I'm doing wrong because there seems to be no difference really. Could I PM you the file by chance? It has a bunch of peoples names and email addresses, so I wouldn't like it to be posted.

  10. #10
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    As far as I know, it is not possible to attach a file to a private message, this is probably a deliberate setting to stop people abusing the system.

    Bit of a long shot, but have you tried copying data from the original to a new file to see if that works?

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,455

    Re: Hyperlink disappearing when certain conditions are met

    You need to desensitise the data - change names to Person 1 and E-Mails to [email protected], etc.

    We won’t need a full dataset, anyway.

    Even if it were possible to send a file by PM, you would still need to desensitise it: this is a public forum and you should never trust any of us with other people’s personal details.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  12. #12
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Jason,

    I was able to deduce why it would not even attempt to send the emails. The macro was referencing a cell which contained a vlookup to determine the email address to send it to, so I had to change the macro from .Cells.SpecialCells(xlCellTypeConstants) to .Cells.SpecialCells(xlCellTypeFormulas).

    The only remaining issue is that it is not recognizing the line breaks and prints out the "%0A" in the email itself.

    *EDIT - After we have the line breaks figured out, I was wondering if it was possible to add a commented out line for where I can place an attachment if I decide to add it in later.
    Last edited by xAcrosonicx; 08-12-2019 at 11:00 AM.

  13. #13
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Formulas to make up the email addresses was something that I hadn't given consideration to. Like Ali said, you should never provide files with personal data to anyone on the site (or any other site), but without the original file to test, I would never have found it. Best suggestion is to create a copy of the original using Save As, then remove anything from the copy that is not needed, but leave the formulas in place in places where they are related to the question, overwriting your real data with fiction.

    The %0A part was something that I didn't recognose, so I just left it in from your existing formula, I assumed that it was something that you had found elsewhere.

    Not sure if it will be recognised when it is passed to outlook, but try using CHAR(10) as the delimiter instead of "%0A".

    Note that there are no double quotes around CHAR(10), excel needs to see it as a function, not as text.

    If that comes out on a single line as well, take a look at 'Method 1' here, https://support.microsoft.com/en-gb/...mat-in-outlook before trying any other alternatives.
    Last edited by jason.b75; 08-12-2019 at 11:16 AM.

  14. #14
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    I ended up changing the VBA to use .HTMLBody and changed %0A (which Outlook generally accepts as a line break) to <br> in order to work properly. I also used this to add my default signature to the file.

    The last thing I need (so close!) is the addition of a commented out line that I can use later on to add unique files for each email being sent. I know how to add a single file that is the same for each email, but that is not what i am looking for. I would assume I must create a new column in excel with all of the locations and use that in my Attachments.Add line?
    Last edited by xAcrosonicx; 08-12-2019 at 11:49 AM.

  15. #15
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    If you go back to the post with the new formula and vba code, you will see a link to Ron de Bruin's site, I remember seeing something about attachments when I found the code there, you might need to look around a bit though, it wasn't on the same page. If you have no luck then I'll look into it for you when I get home later.

  16. #16
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Great, I'll have a look around and let you know if I am unable to find anything. Thank you for all your help, I truly appreciate it!

  17. #17
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Not sure if I misread post #14 or read it before you edited, but looking at it again I would say that you would need another column.

    Having said that, if all of the files are in the same folder, then you could do it with just the file name listed in excel and join the path to it in vba.

    Is there anything already in the sheet that could be used to identify the correct file? First part of the users email address for example?

  18. #18
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Sorry, I ended up changing my mind and editing out my question - I didn't realize you saw what I had originally said. The files will all be located in the same folder, with the naming convention FilenameFirstnameLastname and I can very easily add everyone's first and last names to the spreadsheet if necessary. I am only confused about the actual edit to the VBA that I will need, I'm not worried about tweaking the specific locations that it searches and such. Here's what I currently have that works exactly how I would like it to (excluding the attachments, of course)
    Please Login or Register  to view this content.
    Last edited by xAcrosonicx; 08-13-2019 at 09:15 AM.

  19. #19
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    It should be as simple as adding a line like
    Please Login or Register  to view this content.
    Where some_file refers to the string making up the file path and name.
    I would suggest adding it as a new line between .Subject and .HTMLBody.

    Are email addresses in the form of [email protected]

    If they are then it would be fairly simple to grab the name from there and make up the file name.

  20. #20
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    But wouldn't the code you suggested use the same file for everyone? Email addresses are in the form of [email protected]. Just be sure we're on the same page - I have a folder on my desktop called "360 Reviews" with files such as ReviewJakePetersen.docx and so on. If Jake Petersen happens to come up in the email list that I generate, I want his email to have the attachment just mentioned on it. But I also want any other person on the email list to have their own ReviewFirstLast attached to their email.

    Would it work to do something similar to what we did with the body line, but for the attachment? I can create a new column that will run the vlookup to associate the file name with the person selected and print the name in the cell (say, N2 for example). But I will then need the VBA to look for the attachment in N2 for the first email, N3 for the second email, and so on.
    Last edited by xAcrosonicx; 08-13-2019 at 10:24 AM.

  21. #21
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    I was just about to suggest this, then re-read your reply and noticed that email is only initial, not full name.
    Please Login or Register  to view this content.
    edit:- I've changed the line of code above so that it takes first name from the first part of the formula in column N by extracting whatever is between "Hello " and the first comma, "Hello FirstName,", then takes the last name from the email address in column M, taking the second character, up to the one before the @ symbol.

    Once you edit the part in red so that it matches the correct location for the folder on your desktop, it should (I hope) work as needed.
    Last edited by jason.b75; 08-13-2019 at 11:21 AM.

  22. #22
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    That looks great! I haven't created the files themselves yet, but this should do the trick for them. Thanks for all your help, I appreciate it!

  23. #23
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    You're welcome, thanks for the feedback!

  24. #24
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    Just tested out the formula! I changed it slightly to target my new location of the files. Is it possible to have a cell that prints out the file name (if applicable) For example, next to the reviewer name and email address i want to add a column that will automatically look up the FileFirstLast in my folder to see if it exists, and print out the name of the file to show that it will send the right one if it is applicable. Below is the working code I use in my VBA.
    Please Login or Register  to view this content.

  25. #25
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Changing .Attachments.Add to cell.Offset(,x) will do that. Simply change x to a number indicating the column to use. cell is locked to column M so Offset(,1) will be column N (1 to the right). If you want to go left, use negative numbers instead.

    This will not check if the file exists though, but that can be done if needed.

  26. #26
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hyperlink disappearing when certain conditions are met

    I would much prefer if it checked if the file existed, rather than just printing out what the file name would be. This will allow for a quick check that the file will actually be sent and was not spelled wrong in the naming convention or anything like that.

  27. #27
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    Ok, bear with me. There are people that can write the code to do that in seconds, unfortunately, I'm not one of them.

    I have some code for doing it, but I will need to find it and then fit it into yours, so might take a while.

  28. #28
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Hyperlink disappearing when certain conditions are met

    I haven't been able to test this due to not having outlook inatalled,
    Please Login or Register  to view this content.
    Changes highlighted in red. If I've got the syntax right, it should test the attachment and post the path and filename in column N, if not found then it should show an 'Attachment not found' message there instead and not create the mail message for that user.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-14-2016, 03:53 PM
  2. Disappearing shapes
    By MikeWinn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2010, 02:41 PM
  3. Mac Excel 2008 Hyperlink Disappearing
    By TheRedOak in forum Excel General
    Replies: 0
    Last Post: 03-29-2008, 10:58 AM
  4. [SOLVED] Disappearing C
    By Stacey in forum Excel General
    Replies: 10
    Last Post: 06-21-2006, 12:00 PM
  5. Disappearing C
    By Stacey in forum Excel General
    Replies: 0
    Last Post: 05-26-2006, 01:05 PM
  6. [SOLVED] how do I keep a worksheet from disappearing?
    By Jocats1 in forum Excel General
    Replies: 0
    Last Post: 05-05-2006, 02:50 PM
  7. [SOLVED] Add-Ins Disappearing?
    By Ben in forum Excel General
    Replies: 3
    Last Post: 07-18-2005, 05:39 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1