Solved

Access 2003 clipboard hyperlink problem

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

785 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