Solved

Access 2003 clipboard hyperlink problem

Posted on 2013-11-26
3
233 Views
Last Modified: 2013-11-28
I have a form that takes name/address/plus info copied to the clipboard from the internet. It then parses it into an Access table.

I have a problem when one of the lines copied is a hyperlink.  When there is a hyperlink it gets included with the previous line (no carriage return on the previous line).

Example of lines on internet copied:

Your Source For Local Real Estate
http://www.MyRealtor.com/

When pasted onto the form they appear as:

Your Source For Local Real Estatehttp://www.MyRealtor.com/

My copy function:

Function GetClipBoardText()
   Dim DataObj As MSForms.DataObject
   Set DataObj = New MSForms.DataObject
   On Error GoTo cberr
    'Get data from the clipboard.
   DataObj.GetFromClipboard
   [ipAddrInfo].SetFocus
   'Get clipboard contents
   [ipAddrInfo] = DataObj.GetText(1)
   Exit Function
cberr:
   If Err <> 0 Then MsgBox "Data on clipboard is not text or is empty"
End Function
0
Comment
Question by:WFBweb
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
jaynee earned 180 total points
ID: 39684626
Not sure why its happening, but you could parse for the start of the hyperlink, and if you find "http:/" then just add a chr(10) to the start of it.
0
 
LVL 7

Expert Comment

by:jaynee
ID: 39684633
eg

[ipAddrInfo] = StrTranOnce(DataObj.GetText(1), "http:/", chr(10)&"http:/")

where

Public Function StrTranOnce(Instring As String, FindChar As String, ReplaceChar As String) As String
  Dim tmpString As String, CharPosition As Integer
  StrTranOnce = Instring
  If FindChar = ReplaceChar Or Trim(Instring) = "" Then Exit Function
  CharPosition = InStr(1, Instring, FindChar, 1)
  tmpString = Left(Instring, CharPosition - 1)
  tmpString = tmpString + ReplaceChar
  StrTranOnce = tmpString + Mid(Instring, CharPosition + Len(FindChar))
End Function
0
 

Author Closing Comment

by:WFBweb
ID: 39684659
thanks.....that does the trick!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question