[本地IT决定在一夜之间不给任何人通知就重新映像PC;对于备份数据的普通人来说,这不是一个问题,但是不幸的是,我在备份数据方面非常不好...长话短说,我正在尝试重新创建几个月前写的一个webscrape,停留在一个步骤,我不记得我要为谷歌找到答案的地方。
有一个选择框可以选择不同的选项(允许多个),我不记得我过去写选择某些选项的方式。下面是我正在做的概述以及HTML的屏幕截图。
[我最记得的是选择日期后,虽然仍然是html文档形式,但我还是沿用了]]
if range[first lookup cell here] = [LOB I was pulling data for] then childrow1.selected = true else childrow1.selected = false End if if range[second lookup cell here] = [LOB I was pulling data for] then childrow2.selected = true else childrow2.selected = false End if Etc, etc
默认情况下,所有选择均开始选择,我找不到取消所有选择的方法。我知道这不是要使用的确切代码,但这就是正在发生的事情的要旨。到目前为止,共有36个技能代码,每个LOB的2-8个取决于LOB。这是网站上用于选择框的HTML:Selection Box HTML
<SELECT id=Skill class=summarySmallCallibriCenter multiple size=3 name=Skill rdInputValueDelimiter=",">
<OPTION selected value=44413 Row="1">44413</OPTION>
<OPTION selected value=44414 Row="2">44414</OPTION>
<OPTION selected value=44415 Row="3">44415</OPTION>
<OPTION selected value=44416 Row="4">44416</OPTION>
<OPTION selected value=44420 Row="5">44420</OPTION>
<OPTION selected value=44421 Row="6">44421</OPTION>
<OPTION selected value=44422 Row="7">44422</OPTION>
<OPTION selected value=44423 Row="8">44423</OPTION>
<OPTION selected value=44426 Row="9">44426</OPTION>
<OPTION selected value=44433 Row="10">44433</OPTION>
<OPTION selected value=44485 Row="11">44485</OPTION>
<OPTION selected value=44486 Row="12">44486</OPTION>
<OPTION selected value=44491 Row="13">44491</OPTION>
<OPTION selected value=44492 Row="14">44492</OPTION>
<OPTION selected value=44494 Row="15">44494</OPTION>
<OPTION selected value=44495 Row="16">44495</OPTION>
<OPTION selected value=44496 Row="17">44496</OPTION>
<OPTION selected value=44497 Row="18">44497</OPTION>
<OPTION selected value=44500 Row="19">44500</OPTION>
<OPTION selected value=44505 Row="20">44505</OPTION>
<OPTION selected value=44506 Row="21">44506</OPTION>
<OPTION selected value=44507 Row="22">44507</OPTION>
<OPTION selected value=44508 Row="23">44508</OPTION>
<OPTION selected value=44509 Row="24">44509</OPTION>
<OPTION selected value=44510 Row="25">44510</OPTION>
<OPTION selected value=44516 Row="26">44516</OPTION>
<OPTION selected value=44523 Row="27">44523</OPTION>
<OPTION selected value=44535 Row="28">44535</OPTION>
<OPTION selected value=44536 Row="29">44536</OPTION>
<OPTION selected value=44537 Row="30">44537</OPTION>
<OPTION selected value=44539 Row="31">44539</OPTION>
<OPTION selected value=44544 Row="32">44544</OPTION>
<OPTION selected value=44545 Row="33">44545</OPTION>
<OPTION selected value=44548 Row="34">44548</OPTION>
<OPTION selected value=44555 Row="35">44555</OPTION>
<OPTION selected value=44556 Row="36">44556</OPTION>
</SELECT>
我真的只是在寻找要放在哪里的代码的答案,但是如果还有一种更简单的方法来执行此过程,我会非常高兴。我从选择框中获取内部html的原因是,虽然技能代码并不会经常更改,但我希望为将来的任何更改做好准备并做好准备。就像我丢失它之前一样,有6个宏(每个LOB一个),每个宏上面的代码重复36次。它可能不是最有效的,但是可以完成工作。
我是自学成才的,仅在VBA中写作了大约6个月,所以请保持温柔。如果需要任何其他信息,请告诉我。
直到下面的代码:
Sub Service_Level_Pull() Dim ieApp As Object Dim ieDoc As Object Dim ieTable As Object Dim clip As DataObject Dim NextToDo As String Dim ntdrng As Range Dim NextEmptyDone As Long Set ieApp = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}") ieApp.Visible = True ieApp.Navigate [login link here] While ieApp.Busy DoEvents Wend Set ieDoc = ieApp.Document Do While ieApp.ReadyState <> READYSTATE_COMPLETE DoEvents Loop With ieDoc.forms(0) .UserName.Value = [username here] .UserPass.Value = [pw here] End With With ieDoc.forms(0) .submit End With Do While ieApp.ReadyState <> READYSTATE_COMPLETE DoEvents Loop Do ieApp.Navigate [webscrape target link here] Do While ieApp.ReadyState <> READYSTATE_COMPLETE DoEvents Loop With ieDoc.forms(0) .ipStartDate.Value = (Date - Day(today)) + 1 .ipEndDate.Value = today - 1 With ieDoc.forms(0).skill
[本地IT决定在一夜之间不给任何人通知就重新映像PC;对于备份数据的普通人来说,这不是问题,但是不幸的是,我在备份数据方面很不好...长话短说,...
我知道了!我改变了一些东西的计算方式,最终我写的代码是:
Do Until n = SkillCount
With ieDoc.forms(0)
.ipStartDate.Value = Format(Date - Day(Date) + 1, "mm/dd/yyyy")
.ipEndDate.Value = Format(Now() - 1, "mm/dd/yyyy")
End With
Set drp = ieDoc.forms(0).skill
If Application.WorksheetFunction.CountIf(Range(Cells(3, y).Address, Cells(Cells(1, y).Value + 2, y).Address), drp.Children(n).Value) > 0 Then
drp.Children(n).Selected = True
Else
drp.Children(n).Selected = False
End If
n = n + 1
Loop