View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
dollardoc dollardoc is offline
external usenet poster
 
Posts: 2
Default Paste a hyperlink if cell contains XXXX...

Partly answers my dilemma. I have a form with 20 lines that uses a macro to
paste into a database. In Cell D18 it can be either text or a hyperlink.
Problem is that the macro pastes the hyperlink in D18 to DBase as text
instead of the link. 1) how do you add the IF THEN to determine if the text
is actual hyperlink and then paste it as such, or 2) if I make the cell only
available for hyperlinks, how to get it copied to DBase if cell has link in
it, or if cell is blank? thanx 4 this great service. tom dollardoc

"Dick Kusleika" wrote in message
...
quartz
Try this
Sub test()
Dim sVar As String
sVar = "c:\book1.xls"
With Sheet1.Range("A1")

.Hyperlinks.Add .Cells(1, 1), sVar 'Does this format cell a
Hyperlink?'
End With

End Sub
--

Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

quartz wrote:
I have a the full name of a file in a string variable. I need example
code on how to paste it into a cell as a hyperlink, so that if it is
clicked the file will open in its native format (i.e. Excel in Excel,
Word in Word, etc.).

I tried to record it, but that doesn't work. Can somone please help
me out?

Thanks much in advance.