![]() |
hyperlinks
I want to send file by using hyperlinks for the address. However, if I copy a
new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
This line of code should help you
myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
Thanks but unfortunately it did not work. should my url get the value of the
address? The only thing I am looking for is to activaye the particular cell with the new contents. In the worksheet one should just activate the input bar create hard return and this should done by a macro. The simple code is as follows Range("R2").Select Selection.Copy Range("A19").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False A19 contains a text that should be a hyperlink. The old value of that cell should be remoevd. Hoever in the current setup the old value still exist underneath. This might be caused to a background query. Many thanks for any further advice "Barb Reinhardt" wrote: This line of code should help you myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
Dim myWS as Worksheet
Set myWS = activesheet myWS.Hyperlinks.Add _ anchor:= myWS.Range("A19") _ Address:=myWS.Range("R2").Text, _ TextToDisplay:=myWS.Range("R2").Text -- HTH, Barb Reinhardt "Nak75" wrote: Thanks but unfortunately it did not work. should my url get the value of the address? The only thing I am looking for is to activaye the particular cell with the new contents. In the worksheet one should just activate the input bar create hard return and this should done by a macro. The simple code is as follows Range("R2").Select Selection.Copy Range("A19").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False A19 contains a text that should be a hyperlink. The old value of that cell should be remoevd. Hoever in the current setup the old value still exist underneath. This might be caused to a background query. Many thanks for any further advice "Barb Reinhardt" wrote: This line of code should help you myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
Thanks so far but when I copy the code into a procedure I got compile errors.
You dimmed myWS, should I dim anchor and address as well and if yes what is it? a string. or are anchor and adress VBA objects. I tried several things but all these failed. Sorry to bother yu again but could you pls help me out. Thanks "Barb Reinhardt" wrote: Dim myWS as Worksheet Set myWS = activesheet myWS.Hyperlinks.Add _ anchor:= myWS.Range("A19") _ Address:=myWS.Range("R2").Text, _ TextToDisplay:=myWS.Range("R2").Text -- HTH, Barb Reinhardt "Nak75" wrote: Thanks but unfortunately it did not work. should my url get the value of the address? The only thing I am looking for is to activaye the particular cell with the new contents. In the worksheet one should just activate the input bar create hard return and this should done by a macro. The simple code is as follows Range("R2").Select Selection.Copy Range("A19").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False A19 contains a text that should be a hyperlink. The old value of that cell should be remoevd. Hoever in the current setup the old value still exist underneath. This might be caused to a background query. Many thanks for any further advice "Barb Reinhardt" wrote: This line of code should help you myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
I'm not sure why you'd get compile errors. On what line do you get the
error and what is the error? You may also want to do something like this Debug.print myWS.name Debug.print myWS.Range("A19").address Debug.print myWS.Range("R2").text to see what's in those -- HTH, Barb Reinhardt "Nak75" wrote: Thanks so far but when I copy the code into a procedure I got compile errors. You dimmed myWS, should I dim anchor and address as well and if yes what is it? a string. or are anchor and adress VBA objects. I tried several things but all these failed. Sorry to bother yu again but could you pls help me out. Thanks "Barb Reinhardt" wrote: Dim myWS as Worksheet Set myWS = activesheet myWS.Hyperlinks.Add _ anchor:= myWS.Range("A19") _ Address:=myWS.Range("R2").Text, _ TextToDisplay:=myWS.Range("R2").Text -- HTH, Barb Reinhardt "Nak75" wrote: Thanks but unfortunately it did not work. should my url get the value of the address? The only thing I am looking for is to activaye the particular cell with the new contents. In the worksheet one should just activate the input bar create hard return and this should done by a macro. The simple code is as follows Range("R2").Select Selection.Copy Range("A19").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False A19 contains a text that should be a hyperlink. The old value of that cell should be remoevd. Hoever in the current setup the old value still exist underneath. This might be caused to a background query. Many thanks for any further advice "Barb Reinhardt" wrote: This line of code should help you myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
Hi Barb,
I do not even come to the debug part, By pushing F8 I got a comile error straightaway saying argument not optional. If I fiddle something I got errors like expected end of statement or expected list separator or). Has it something to do with parentheses? I am lost :-) "Barb Reinhardt" wrote: I'm not sure why you'd get compile errors. On what line do you get the error and what is the error? You may also want to do something like this Debug.print myWS.name Debug.print myWS.Range("A19").address Debug.print myWS.Range("R2").text to see what's in those -- HTH, Barb Reinhardt "Nak75" wrote: Thanks so far but when I copy the code into a procedure I got compile errors. You dimmed myWS, should I dim anchor and address as well and if yes what is it? a string. or are anchor and adress VBA objects. I tried several things but all these failed. Sorry to bother yu again but could you pls help me out. Thanks "Barb Reinhardt" wrote: Dim myWS as Worksheet Set myWS = activesheet myWS.Hyperlinks.Add _ anchor:= myWS.Range("A19") _ Address:=myWS.Range("R2").Text, _ TextToDisplay:=myWS.Range("R2").Text -- HTH, Barb Reinhardt "Nak75" wrote: Thanks but unfortunately it did not work. should my url get the value of the address? The only thing I am looking for is to activaye the particular cell with the new contents. In the worksheet one should just activate the input bar create hard return and this should done by a macro. The simple code is as follows Range("R2").Select Selection.Copy Range("A19").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False A19 contains a text that should be a hyperlink. The old value of that cell should be remoevd. Hoever in the current setup the old value still exist underneath. This might be caused to a background query. Many thanks for any further advice "Barb Reinhardt" wrote: This line of code should help you myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
Try this one
myWS.Hyperlinks.Add anchor:=myWS.Range("A19"), _ Address:=myWS.Range("R2").Text, _ TextToDisplay:=myWS.Range("R2").Text -- HTH, Barb Reinhardt "Nak75" wrote: Hi Barb, I do not even come to the debug part, By pushing F8 I got a comile error straightaway saying argument not optional. If I fiddle something I got errors like expected end of statement or expected list separator or). Has it something to do with parentheses? I am lost :-) "Barb Reinhardt" wrote: I'm not sure why you'd get compile errors. On what line do you get the error and what is the error? You may also want to do something like this Debug.print myWS.name Debug.print myWS.Range("A19").address Debug.print myWS.Range("R2").text to see what's in those -- HTH, Barb Reinhardt "Nak75" wrote: Thanks so far but when I copy the code into a procedure I got compile errors. You dimmed myWS, should I dim anchor and address as well and if yes what is it? a string. or are anchor and adress VBA objects. I tried several things but all these failed. Sorry to bother yu again but could you pls help me out. Thanks "Barb Reinhardt" wrote: Dim myWS as Worksheet Set myWS = activesheet myWS.Hyperlinks.Add _ anchor:= myWS.Range("A19") _ Address:=myWS.Range("R2").Text, _ TextToDisplay:=myWS.Range("R2").Text -- HTH, Barb Reinhardt "Nak75" wrote: Thanks but unfortunately it did not work. should my url get the value of the address? The only thing I am looking for is to activaye the particular cell with the new contents. In the worksheet one should just activate the input bar create hard return and this should done by a macro. The simple code is as follows Range("R2").Select Selection.Copy Range("A19").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False A19 contains a text that should be a hyperlink. The old value of that cell should be remoevd. Hoever in the current setup the old value still exist underneath. This might be caused to a background query. Many thanks for any further advice "Barb Reinhardt" wrote: This line of code should help you myWS is theworksheet I'm adding the hyperlink to. myWS.Hyperlinks.Add _ anchor:= myWS.Range("C5") _ Address:=myURL, _ TextToDisplay:=TextToDisplay -- HTH, Barb Reinhardt "Nak75" wrote: I want to send file by using hyperlinks for the address. However, if I copy a new adres in a cell, the cell displays the new name but underneath the old adress is still there resulting in an email with the old adress. By activating the inptu bar and double click it this is resolved. However I want to do it by a macro in one go. Who could help me out? Many thanks Frank |
hyperlinks
|
All times are GMT +1. The time now is 09:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com