Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2012, 07:15 AM
Registered User
 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access a webform dropdown box

Hello all,
I am trying to fill a webform with the details from an excel sheet. It contains few textboxes and dropdown list. I have to select a value from the dropdown list. I am able to fill the textboxes but not able to access the dropdown list. I don't know where I am going wrong. I am attaching the code. Kindly help me to proceed.

Code:
Dim objFile, strGuyFile, intRow
Dim objExcel, strPathExcel, col1, objSheet, col2
Dim objFSO,objFolder,FolderPath, Filescoll

WScript.Echo "hello"
'FolderPath = "C:\Admin\file.xls"
path = "C:\Admin\file.xls"
 
Set objFSO=CreateObject("Scripting.FileSystemObject")
'Set objFolder=objFSO.GetFolder(FolderPath)

 Set objExcel = CreateObject("Excel.Application")
 objExcel.Workbooks.open path
 WScript.Echo "file opened"
 'WScript.Echo path 
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

intRow = 2
Do Until intRow=6
col1 = Trim(objSheet.Cells(intRow, 1).Value)
col2 = Trim(objSheet.Cells(intRow, 2).Value)
col3 = Trim(objSheet.Cells(intRow, 4).Value)
col4 = Trim(objSheet.Cells(intRow, 11).Value)
col5 = Trim(objSheet.Cells(intRow, 10).Value)
WScript.Echo col1 & " ," & col2
intRow = intRow+1
Loop   
objExcel.Quit

set a = createobject("wscript.shell")
a.run "http://xxx.com" (not displaying the site name)
wscript.sleep (8000)
a.SendKeys "{TAB 5}"
wscript.sleep (2000)
a.sendkeys (col1)
a.SendKeys "{TAB}"
a.sendkeys (col2)
a.SendKeys "{TAB}"
a.sendkeys (col3)
a.SendKeys "{TAB}"
a.sendkeys (col3)
a.SendKeys "{TAB}"
a.sendkeys (col2)
a.SendKeys "{TAB}"
a.sendkeys (col4)
a.SendKeys "{TAB}"
a.sendkeys (col4)
a.SendKeys "{TAB}"
a.SendKeys (col5)
a.SendKeys "{TAB}"

SetCombo() 
 Public Sub SetCombo()
 'WScript.Echo "hi" 
Set objSW = CreateObject("ShellWindows.Application") 
 Set obj = CreateObject("InternetExplorer.Application")   

'On Error Resume Next
For Each Obj In objSW
  objLoc = ""
  objLoc = Obj.LocationName
  Debug.Print objLoc
  If objLoc = "xxx.com::Userpanel" Then 'Tested with IE6
  i = 0 
   'WScript.Echo obj.document.All.Item(sbHolder_5775136).Value 					
 For Each i In Obj.document.All.Item("94049960").Value 
  If (StrComp(i,Kolkata)=0) Then
     WScript.Echo "true"
        Else
        WScript.Echo "false"
       End if
      Exit For
      Next 
   Exit For
  End If
   
Next
Set Obj = Nothing
End Sub
  
    
  'WScript.Echo obj.sbHolder_5775136.value

a.SendKeys "{TAB 3}"
a.SendKeys "{ENTER}"



call msgbox("Finished")
wscript.quit
Kindly help me.

Thanks in Advance

Last edited by jenna123; October 24th, 2012 at 07:18 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Apply change function on one dropdown to fill another dropdown box SZhang BOOK: Professional ASP.NET MVC 2 0 November 23rd, 2010 05:12 AM
ASP.Net, Access DB, and a webform? TheNinthPlayer BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 June 3rd, 2008 10:28 AM
Standard Dropdown Combo box dartcoach VB How-To 8 November 8th, 2006 10:25 PM
Dropdown Box problem migarich ASP.NET 1.0 and 1.1 Basics 3 March 22nd, 2006 10:28 AM
Problem with dropdown box Hlybbi C# 5 August 31st, 2004 04:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.