Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old March 28th 17, 09:43 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Mar 2017
Posts: 1
Default How can we paste data on Google.com

Hi FOlks

I have successfully copied the range and opened the internet explorer and unable to paste it in google.com here is code.. I am quite new with VBA, I am still learning so many things. I want this code to copy the user selected value and input it on Google.com and hit enter or search


Can anybody help... please?

Sub Googlesearch()

Dim WorkRng As Range
On Error Resume Next
xTitleId = "AddForExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Ws = WorkRng.Copy

Dim ie As Object
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.NAVIGATE "http://www.Google.com"
ie.Visible = True
ie.activate.sendkey"^v" &"{ENTER}


End Sub

  #2   Report Post  
Old April 1st 17, 12:12 AM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2015
Posts: 99
Default How can we paste data on Google.com

Hi,

Here is an example to navigate to google page and another to see Web Objects Name
You must add the Microsoft HTML Objects Library referenceand the Microsoft
Internet Control references

Sub Googlesearch()
Dim i As Integer
Dim IE As InternetExplorer
Dim maPageHtml As HTMLDocument
Dim Helem As IHTMLElementCollection
Set IE = CreateObject("internetExplorer.Application")
IE.Visible = True
IE.navigate "http://www.google.ca/"
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set maPageHtml = IE.Document
Set Helem = maPageHtml.getElementsByTagName("input")
For i = 0 To Helem.Length - 1
If Helem(i).getAttribute("name") = "q" Then 'name "q" is the name of
searched words box
Helem(i).innerText = "Word to look for" ' or WorkRng
Helem(i + 1).Click 'Search button comes just after q, so i + 1
End If
Next
End Sub

Sub WebObjectsName()
Dim i As Integer
Dim IE As InternetExplorer
Dim maPageHtml As HTMLDocument
Dim Helem As IHTMLElementCollection
Set IE = CreateObject("internetExplorer.Application")
IE.Visible = True
IE.navigate "http://www.google.ca/"
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set maPageHtml = IE.Document
Set Helem = maPageHtml.getElementsByTagName("input")
For i = 0 To Helem.Length - 1
Range("A" & i + 1) = Helem(i).getAttribute("name")
Range("B" & i + 1) = Helem(i).getAttribute("value")
Next
End Sub

isabelle

Le 2017-03-28 √* 04:43, Vipul Purohit a √©crit :
Hi FOlks

I have successfully copied the range and opened the internet explorer and unable to paste it in google.com here is code.. I am quite new with VBA, I am still learning so many things. I want this code to copy the user selected value and input it on Google.com and hit enter or search


Can anybody help... please?

Sub Googlesearch()

Dim WorkRng As Range
On Error Resume Next
xTitleId = "AddForExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Ws = WorkRng.Copy

Dim ie As Object
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.NAVIGATE "http://www.Google.com"
ie.Visible = True
ie.activate.sendkey"^v" &"{ENTER}


End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL PASTE DOES NOT CHANGE DATA - PASTE DOESN'T WORK! robin l Excel Worksheet Functions 7 April 16th 09 07:56 PM
Create Macro to Copy and Paste into Google Maps Bryan Excel Programming 0 October 11th 07 05:29 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 06:16 PM
Google Bob Phillips Excel Discussion (Misc queries) 4 December 2nd 04 06:44 PM
A pun on Google steve Excel Programming 6 August 4th 03 03:47 PM


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2004-2017 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017