Paste from clipboard to active browser

TimTin

New Member
Joined
Jun 30, 2010
Messages
4
Problem:
I am creating a form with a webbrowser as an object inside.
From a sheet in excell I want to copy information from several cells to the browser in my form. I have no specific destination in the browser form, as you can see in the code snippet I am tabing my way through the form using send key command. What is killing me is the Paste command, sendkeys "^V" does not work. Other then that the code is working as a charm. I just want to empty the clipboard in the active area in the browser thats it.....

My code example, I have commented out the trial and errors I have already done (Some of them are way off, but in desperation you try anything :))

Private Sub CommandButton1_Click()
'''''''''''''''''''
Dim NR
NR = WorksheetFunction.CountA(Columns("A:A"))
Dim SR
SR = 2
Do While SR < NR + 1
'''''''''''''''''''''''''''''''''''''''''''''''''''
Sheets("S1").Range("B" & SR).Copy
Me.WebBrowser1.SetFocus
SendKeys "{TAB}", True

'ActiveWindow.Activate
'Paste
'Paste True
'Call Paste.Execute
'SendKeys "^V", True
'SendKeys.KeyDown (Keys.ControlKey)
'SendKeys.KeyPress (Keys.v)
'SendKeys ("^V"), True
'Call Paste

Sheets("S1").Range("C" & SR).Copy
Me.WebBrowser1.SetFocus
SendKeys "{TAB}", True

'ActiveWindow.Activate
'Paste
'Paste True
'Call Paste.Execute
'SendKeys "^V", True
'SendKeys.KeyDown (Keys.ControlKey)
'SendKeys.KeyPress (Keys.v)
'SendKeys ("^V"), True
'Call Paste

SendKeys "{TAB}", True
SR = SR + 1
Loop
Finito:
End Sub

// Tim
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If there are any other person who have the same problem, the solution is simple.
Do not attempt to copy anything, as long as it is text value you just dim value as string and refer to the string instead. Like this form my example.....

Dim FV As String 'First Value
FV = Sheets("S1").Range("B" & SR).Value
SendKeys (FV)

// TimTin
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,467
Members
448,965
Latest member
grijken

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