Problem Importing Delimited Data from IE

  • Thread starter Thread starter Jim W.
  • Start date Start date
J

Jim W.

I am having a problem with getting the delimited text data
from IE to the clipboard to cell "A1". I can copy all data
into a single cell. I am trying to mimic the manual
process of Selecting All on a delimited text web page,
Copy and then Pasting it into my worksheet. I have Office
2K

I have tried:
Clipboard.Clear
Clipboard.SetText ie.Document.Body.InnerText.Copy
(I got this from working VB6 code)
It fails at the first reference of the Clipboard so I
didn't show the rest.

I've tried the following also:
ie.Document.Body.InnerText
Destination:=ActiveWorkbook.Worksheets(1).Range("A1")

Any Ideas?
Thanks,
Jim
 
Excellent suggestion Tom - Many thanks

Here's what I did:

Dim ie As Object
Dim ABC As New DataObject
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate sURL_Link
Do Until ie.ReadyState = 4 'Busy
DoEvents
Loop

ClearClipboard
ABC.SetText ie.Document.Body.InnerText
ABC.PutInClipboard
Worksheets(PrefixedPN).Select
Range("A1").Select
GetOffClipboard
ActiveCell.PasteSpecial

Here's The Additional Code from Chip Pearsons Site that I
used.
Public Sub PutOnClipboard(Obj As Variant)
Dim MyDataObj As New DataObject
MyDataObj.SetText Format(Obj)
MyDataObj.PutInClipboard
End Sub
Public Function GetOffClipboard() As Variant
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GetOffClipboard = MyDataObj.GetText()
End Function
Public Sub ClearClipboard()
Dim MyDataObj As New DataObject
MyDataObj.SetText ""
MyDataObj.PutInClipboard
End Sub
 
Back
Top