Results 1 to 1 of 1

To Copy cell data from excel to web page field

Threaded View

sugaprasad To Copy cell data from excel... 09-04-2013, 06:21 AM
  1. #1
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    To Copy cell data from excel to web page field

    Hi Everyone,

    I am creating a macro that should open a webpage and then take the value from a cell in Excelsheet and paste into a Text Box in a Webpage.

    for time being am passing the cell value from code itself instead of taking from excelsheet. My initial step is to access the Tex tbox in the webpage. for that I took the ID of the text box.

    Am getting "Run Time error 91 : Object variable or With block variable not set " on the line where i try to pass the value for the text box.

    Sub VisitWebsite()
    
    Const cURL = "http://xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    
    
    
    Dim IE As InternetExplorer
    Dim doc As HTMLDocument
    Dim LoginForm As HTMLFormElement
    Dim ContentID As HTMLInputElement
    
    Dim HTMLelement As IHTMLElement
    
    
    Set IE = New SHDocVw.InternetExplorer
    
    IE.Visible = True
    IE.navigate cURL
    
    Do
    Loop Until IE.readyState = READYSTATE_COMPLETE '= 4
    Set doc = IE.Document
    
    Set LoginForm = doc.forms(0)
    
    
    Set ContentID = LoginForm.elements("dDocName")
    ContentID.Value = "1234"     ' Line where the error occurs "Run Time error 91 : Object variable or With block variable not set "
    
    End Sub
    The following is the HTML of that textbox

    <tr>
    	<td align="right"><label for="dDocName"><span class="searchLabel">Content ID</span></label></td>
    	<td>
    		<input type="hidden" name="opSelected" value="hasAsSubstring">
    		<input type="text" size=30 id="dDocName"name="dDocName" value="" onKeyPress="checkForEnter(event)">
    	</td>
    </tr>

    am i taking the correct ID of that textbox?
    Please help me to overcome this error.
    Last edited by sugaprasad; 09-04-2013 at 06:25 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy Data from form field and paste into worksheet cell
    By azhark in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2013, 04:47 PM
  2. How to copy data from a cell in excel onto a field in a table in access db using vba
    By Codeeachday in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2013, 09:58 PM
  3. How to copy selected column to another page under a specifik field?
    By robissme in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2012, 12:22 PM
  4. Copy data from a cell to a field in Internet Application
    By taps in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2011, 06:29 AM
  5. Update Page Field on selection of another page field in excel pivot table
    By ashwanileon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-29-2011, 12:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1