View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
sifar sifar is offline
external usenet poster
 
Posts: 22
Default Copy outside Clipboard contents (html page) to a cell in Excel

hi,

The below code works fine for me, with the exception that i cannot
paste it to the row.

I could not understand your code.

Attribute VB_Name = "Module1"
Option Explicit
Dim LastRow As Long

Public Function GetOffClipboard() As Variant
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
GetOffClipboard = MyDataObj.Gettext()
End Function

Sub PasteTxT()
On Error Resume Next 'had to put an error handler to avoid copy/paste
errors...
With ActiveWorkbook.Worksheets(2)
.Activate
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
.UsedRange.Cells(LastRow + 1, "A").Activate
ActiveCell.Select
msgbox(GetOffClipboard) 'To check if clipboard has text..
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True
End With
End Sub

Unable to paste text into the rows....thats all...wants to acheive that
.....will really help in speeding up copying data from outside
applications like a mail message(*.msg).

Rgds,

Sifar