Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-05-2014, 05:08 PM
Liquid Liquid is offline Excel 2003 VBA Help copying innertext Windows 7 64bit Excel 2003 VBA Help copying innertext Office 2003
Novice
Excel 2003 VBA Help copying innertext
 
Join Date: Apr 2014
Posts: 2
Liquid is on a distinguished road
Default Excel 2003 VBA Help copying innertext

Hello everyone, I'm still new to VBA and trying to figure out how to copy the innertext from the description. After I get VBA to go out to IE navigate to www.lenox.com and search a sku number. I get no errors in my code below but I'm doing something wrong. I can't figure out how to get the innertext to copy into a cell. here is my code below. It always leaves it blank on me. Hopefully someone can help me out. I'd really appreciate it.



Code:
Sub Lenoxtest() 
    Dim oForm As Object 
    Dim SKU As String 
    Dim URL As String 
    Dim objIE As Object 
    Dim eRow As Long 
    Dim ele As Object 
    Set sht = Sheets("Sheet1") 
    RowCount = 1 
    sht.Range("A" & RowCount) = "content" 
    sht.Range("B" & RowCount) = "description" 
    Set objIE = CreateObject("InternetExplorer.Application") 
    SKU = InputBox(" Enter Sku #. eg, 845123") 
    With objIE 
        .Visible = True 
        .navigate "http://www.Lenox.com" 
        While objIE.Busy And objIE.ReadyState <> 4: DoEvents: Wend 
        Set objIE = .document.body 
        Set oForm = objIE.getElementsbyTagname("Form") 
        Set oForm = oForm(0) 
        Set oInput = oForm.document.getElementByID("keywords") 
         
        Set oBtn = oForm.document.getElementsbyTagname("input") 
        Set oBtn = oBtn(1) 
         
        oInput.Value = SKU 
        oBtn.Click 
        oForm.submit 
        For Each ele In .document.all 
            Select Case ele.classname 
            Case "title" 
                RowCount = RowCount + 1 
            Case "title" 
                sht.Range("A" & RowCount) = ele.innertext 
            End Select 
        Next ele 
    End With 
    Set objIE = Nothing 
End Sub

here is an example of what it does when you enter a Sku #

http://www.lenox.com/dining/dinnerwa...x?R=25019&kf=1

takes you to a search result like this and then I'm trying to copy the description into excel.

Last edited by macropod; 04-05-2014 at 08:54 PM. Reason: Added code structure
Reply With Quote
 

Tags
copy innertext, excel 2003



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying data from Project to Excel OTPM Project 13 12-20-2013 10:25 AM
Copying a variable size table from Excel via VBA -=bb=- PowerPoint 13 06-05-2013 09:01 AM
Excel 2003 VBA Help copying innertext Copying and pasting from Excel Lorna B Word 1 03-20-2012 11:58 PM
Excel 2003 VBA Help copying innertext Copying text from Excel to Word Fossils13 Office 1 02-22-2010 08:39 PM
Excel 2003 VBA Help copying innertext MS Excel 2004 for Mac - copying dates between documents BCRenton Excel 4 11-10-2009 07:28 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft