Selecting and pasting selection in field on BatchGeo.com

spaceranger

New Member
Joined
Oct 8, 2013
Messages
6
Hi guys

Long time lurker, fist time poster. I'm in need of help to make VBA select and paste a selection from a worksheet in the main field on Create a map | BatchGeo.. . The code is put together from two other codes and my own parts. All the commented lines are things that I've tried and later deactivated.

IT GOES WRONG right around the bold text - I fail to select the field which is needed in order to access it and later paste text in it. I think the name of the field is sourceData (from looking at source code via my browser).

The code IS able to press the button to execute the procedure - but this is done after the text is supposed to be pasted.

Do you know the command to cure my problems?

Thanks!:

Code:
Option Explicit
Sub GeoBatchSelection()
'Requires reference to Microsoft HTML Object Library
Dim ie As Object 'InternetExplorer
'Dim htmlDoc As HTMLDocument
'Dim el As HTMLFormElement
Dim pasteValues As String
Dim vals As Range
Dim r As Long
Dim c As Long

'## Store the values in a delimited string
Set vals = Selection 'Range("B3:I7")
For r = 1 To vals.Rows.Count
    For c = 1 To vals.Columns.Count
        If Not c = 1 Then
            pasteValues = pasteValues & vbTab & vals(r, c)
        Else:
            pasteValues = pasteValues & vbNewLine & vals(r, c)
        End If

    Next
Next

'## Create an instance of IE (alternatively you can probably use WebBrowser2)
'Set ie = New Internetexplorer
Set ie = CreateObject("internetexplorer.application")

'## So you can see what's happening/debug. delete the next line if you want.
ie.Visible = True

'## Navigate to the URL:
ie.Navigate "http://batchgeo.com/map/edit/?map_id=2874687&d=0aa639559d0883376a15e66afdc042b0"

'## Make sure the page has finished loading
Do Until ie.ReadyState = 4
    DoEvents
Loop
'While ie.busy
'    DoEvents
'Wend

'## Set our Document variable
'Set htmlDoc = ie.Document

'## Set the element variable
'Set el = htmlDoc.getElementById("sourceData")


'## click in sourceData to make paste possible
'ie.document.getelementbystyle("display: none;").Focus
'ie.document.getelementbyclass("tableize").Click
[U][I][B]ie.document.getelementbyid("sourceData").Focus
ie.document.getelementbyid("sourceData").Click
[/B][/I][/U]

'## Send the values to the form
'el.innerText = pasteValues
[I][U][B] ie.document.getelementbyid("sourceData").Value = pasteValues[/B][/U][/I]

'## I use this to confirm I have grabbed the correct element, you can delete or comment it out.
MsgBox "The form now contains the following data, although it may not be visible:" & _
        vbNewLine & vbNewLine & _
        pasteValues

'## Update the map
ie.document.getelementbyid("mapnow_button").Click

'## Cleanup
Set ie = Nothing
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I think this is what I'm supposed to click:
<div
class="tableize" style="height: 126px; width: 700px; border: 1px solid rgb(170, 170, 170);
">

<
table class="tableize" cellspacing="0" style="opacity: 1;"> … </table>
<em class="tableize" style="display: none;"> … </em
>

</
div
>
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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