Hi guys
I managed to copy excel data to Clipboard in Csv format:
I managed to login to webpage where my Textarea is:
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!
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!