Greetings,

Let me preface this by saying, I am a total javascript novice and have almost zero experience working with it, although I am very familiar with VBA, so I have a basic understanding of coding principles. What I am trying to do, is send data from an Excel spreadsheet, through an embedded IE web browser, to input fields/text boxes on a javascript object. The method I am using to accomplish this is 'document.getElementByID("xxxx").value = "new value")' but as of right now, I am only partially successful and am having trying getting the ids of all of the text boxes.

Unfortunately, this website is on an intra-network and I am unable to either link the site or copy all of the code, so first I will explain how the site works and then I'll paste some of the code that I have typed up, in hopes that it will be enough for someone to recognize what I am getting at. The site provides map functionality similar to that of Google Maps. After the user logs on, he is presented with maps and a series of drop down menus, which contain tools to manipulate the map in certain ways. The particular tool/function/object I am trying to work with is called Bearing Tools. I am able to initialize this object/function through VBA but using 'document.parentWindow.execScript "new BearingToolsWindow"', which then opens up the subwindow on the website. This sub window contains three input fields where the user can then type in 1. a grid coordinate 2. a direction and 3. a distance. Then the user is able to hit a button called Draw, which will then draw a line on the map from the grid coordinate, along the direction and for the distance that the user typed in. What I want to be able to do, is all the user of my spreadsheet to be able to hit a single button/macro, which will dynamically pull data off the spreadsheet and automatically fill in the three input fields and then press the Draw button.

As of right now, I am only able fill in the first two inputfields. I accomplish this by selecting the first input box and using 'document.getElementById(document.activeElement.id).value = "xxxxx"' in my VBA macro. This then inserts whatever string I have set for "xxxxx" into which ever box the cursor is currently selected on. By using activeElement.id, I get the IDs 'gridText_(long GUID after)' on the first box where the user types in the coordinates and 'magneticNorthInput' for the second input field where the user types in the direction. I know I can easily work my code to fill those in without using activeElement.ID (although I'm not too sure on how to get the GUID without using that method), but the real issue is that activeElement.id does not return an ID for the third input field, where the user types in the distance/length that he wants the line of bearing to be drawn.

However, if I use 'document.activeElement.parentElement.id', I can get unique ids for each input field ('grid_GUID', 'mNorth_GUID' and 'distance_GUID' respectively, where GUID is the long 38 character string). But when I try to use these ids with document.getElementByID, I always get an 'object variable not set' error, implying that it cannot find that id.

1. What am I missing with the document.getElementByID method that is preventing me from changing the values of those three unique IDs? Something to do with parentElement or childNode?
2. Can I use execScript to use some sort of javascript format to add my data to those boxes? (like an array of some sort?). execScript seems to let me run whatever javascript I type in, but so far the only thing I've gotten to work is 'new' and 'alert'.
3. Is there some other method of changing the values of those input fields that I am missing?

Thank you for putting up with my ineptness and for any help you fine folks cans provide!