vba clipboard.getText to textarea Website

faffol

New Member
Joined
May 24, 2012
Messages
7
Hi guys

I managed to copy excel data to Clipboard in Csv format:
Code:
Sub CSVclipboard()

  Dim myRange As Range
  Dim strTemp1 As String
  Dim objDataObject As MSForms.DataObject ' require ref to MSForms library
  Set objDataObject = New MSForms.DataObject
  On Error Resume Next
  Set myRange = Sheets("csv").Range("a1", Range("i1").End(xlDown))
  On Error GoTo 0
   
  If myRange Is Nothing Then
    MsgBox "You cancelled!"
    Exit Sub
  End If
   
  'MsgBox "You chose the range " & myRange.Columns.Count
   For iCntr = 1 To myRange.Cells.Count
    If ((iCntr Mod myRange.Columns.Count) <> 0) Then
      strTemp1 = strTemp1 & myRange.Cells(iCntr) & ";"
    Else
      strTemp1 = strTemp1 & myRange.Cells(iCntr) & vbCrLf
    End If
  Next iCntr
  
  objDataObject.SetText Left(strTemp1, Len(strTemp1) - 1)
  objDataObject.PutInClipboard


End Sub

I managed to login to webpage where my Textarea is:
Code:
Dim HTMLDoc As HTMLDocumentDim oBrowser As InternetExplorer
Sub Website_Login_Test()


Dim oHTML_Element As IHTMLElement
Dim sURL As String


On Error GoTo Err_Clear
sURL = "http://mywebpage.com"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True


oBrowser.navigate sURL
oBrowser.Visible = True


Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE


Set HTMLDoc = oBrowser.Document


HTMLDoc.all("user_login").Value = "mylogin"
HTMLDoc.all("user_pass").Value = "mypassword"


For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
'
' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
sURL = "mywebpage"
Call csvData
Call CSVclipboard


End Sub

And now I have problem to copy clipboard content to textarea on this webpage (name of text area is "csv_import")
I was trying something with HTMLDoc.all("csv_import").Value = clipboard.gettext but it says there is not such object.
I admin the codes above were made based on others experience and I cannot now step forward with this.

Any help will be very appreciated! Advance thanks!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,152
Messages
6,123,323
Members
449,094
Latest member
Chestertim

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top