Solved

Access 2003 clipboard hyperlink problem

Posted on 2013-11-26
3
229 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Some time ago I was asked to create a VBA function that would calculate a check digit for an input number, using the following procedure: First, sum up all the individual digits in the number If that sum value has more than one digit, then sum up …
My experience with Windows 10 over a one year period and suggestions for smooth operation
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

705 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now