ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem Importing Delimited Data from IE (https://www.excelbanter.com/excel-programming/275933-problem-importing-delimited-data-ie.html)

Jim W.

Problem Importing Delimited Data from IE
 
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("A 1")

Any Ideas?
Thanks,
Jim

Jim W[_2_]

Problem Importing Delimited Data from IE
 
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

-----Original Message-----
there is no clipboard object in VBA. The closest is the

DataObject.

See Chip Pearsons page on this for examples of how to use

it.

http://www.cpearson.com/excel/clipboar.htm

--
Regards,
Tom Ogilvy


Jim W. wrote in message
...
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("A 1")

Any Ideas?
Thanks,
Jim



.



All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com