PC Review


Reply
Thread Tools Rate Thread

Any method to copy the hyperlink address from an Office Object?

 
 
Narnimar
Guest
Posts: n/a
 
      13th Jan 2010
Any method to copy the address content only from a hyperlinked Office Object
and paste the same to a cell?
 
Reply With Quote
 
 
 
 
Leung
Guest
Posts: n/a
 
      13th Jan 2010
You cannot copy the link address directly through Excel build-in menu . you
need to use VBA code to do that.

"Narnimar" wrote:

> Any method to copy the address content only from a hyperlinked Office Object
> and paste the same to a cell?

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      13th Jan 2010
Maybe you could use a userdefined function to extract the hyperlink from the
cells that have them.

Option Explicit
Function GetURL(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetURL = ""
Else
GetURL = Rng.Hyperlinks(1).Address
End If
End Function

So if you had a hyperlink in A1, you could put =getURL(a1) in that adjacent
cell.

Be aware that if you change the hyperlink, then this formula cell won't change
until your workbook calculates.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=getURL(a1)

Narnimar wrote:
>
> Any method to copy the address content only from a hyperlinked Office Object
> and paste the same to a cell?


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy method of range object Peter Microsoft Excel Programming 2 25th Sep 2008 06:31 AM
Re: Method 'Copy' of object'_Worksheet failed Bob Phillips Microsoft Excel Worksheet Functions 0 7th Feb 2007 01:17 PM
Method 'Copy' of object'_Worksheet failed stephenh@fuelogic.co.za Microsoft Excel Programming 4 6th Feb 2007 06:23 PM
copy method of object failing =?Utf-8?B?dmoyaW5kaWE=?= Microsoft Excel Programming 0 20th Apr 2006 02:21 AM
How to use Object.Copy(Destination) method PasteSpecial(xlPasteVal =?Utf-8?B?UkFQ?= Microsoft Excel Programming 2 16th Aug 2005 05:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:57 PM.