vba

VBA Automation - Prefilling Combodate Box

早过忘川 提交于 2021-02-02 09:55:30
问题 I am trying to prefill data from Excel to a local intranet website via VBA. I've been able to prefill most data to the site, but I am struggling with this combodate box: Please see HTML code: <div class="form-group row " id="starttime_field"> <label class="col-form-label col-md-3" for="starttime">Start time</label> <div class="col-md-9"> <input type="text" id="starttime" name="starttime" class="form-control" size="30" style="display: none;"><span class="combodate"> <select class="hour " style

CSS selector for reCaptcha checkbok using Selenium and vba excel

随声附和 提交于 2021-02-02 09:54:44
问题 In the website I am trying to fill some fields, there is a checkbok that I need to click to add the check mark in it <div class="rc-anchor-content"><div class="rc-inline-block"><div class="rc-anchor-center-container"><div class="rc-anchor-center-item rc-anchor-checkbox-holder"><span class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox recaptcha-checkbox-expired" role="checkbox" aria-checked="false" id="recaptcha-anchor" dir="ltr" aria-labelledby=

Automate IE via Excel to fill in a dropdown and continue

跟風遠走 提交于 2021-01-30 08:56:31
问题 Admittedly still a newbie with automating IE via Excel but would appreciate whatever help anyone can offer with this. Basically, this opens up a webpage, selects a button, fills in 2 dropdowns, enters a value and then presses another button to display what I need. I do have this working using SendKeys with a bunch of {Tabs}, {`}, {Down}, etc but it's rather clunky. I'd rather do this the right way but I can only get to the 1st dropdown, select the value that I need and then it stops. What I'm

Excel VBA script - stealing focus

一世执手 提交于 2021-01-29 21:35:55
问题 I'm working on a script that pings computers from a list periodically and returns information. My problem is, whenever the the script is running, it steals focus from other excel windows. For example if if I'm typing in another workbook when the scrip runs, it jumps (to the cell that was last selected) and continues writing in the cell. Here is the script: Sub autoping_cb() Dim c As Range Dim thePing As Variant Dim TryCount As Integer Dim TryAgainCount As Integer Dim TryNextRun As Boolean

Error with copy paste due to merged column cells

二次信任 提交于 2021-01-29 21:00:23
问题 I want to copy paste values from 4 columns in one worksheet into 4 columns of another worksheet depending on whether the values in a single column are null or not. Following is my code: Private Sub CommandButton1_Click() Dim lastrow As Long, erow As Long lastrow = Worksheets("jun").Cells(Rows.Count, 1).End(xlUp).Row erow = 20 For i = 8 To lastrow If Worksheets("jun").Cells(i, 16).Value <> "" Then Worksheets("jun").Cells(i, 16).Copy Worksheets("jun").Paste Destination:=Worksheets("test").Cells

Specify Printer when Printing Files

烂漫一生 提交于 2021-01-29 20:52:39
问题 I have a macro that prints all files within a specific folder but each time it opens a file it asks which printer to print from. I want to enter the printer name or IP instead of asking the user or using the default printer. Sub PrintDespatches() Dim wb As Workbook, ws As Worksheet Dim FileName As String, path As String Set wb = ActiveWorkbook Set ws = ActiveSheet path = "Z:\Customer Operations\2021\Despatches\*.csv" FileName = Dir(path, vbNormal) Do Until FileName = "" Application

MSXML2.XMLHTTP fails to send request cookie header

风流意气都作罢 提交于 2021-01-29 20:47:27
问题 I'm trying to create some automated web searches in this website using Excel VBA but in order to use it, you need to agree with it's terms and conditions. The website then stores your agreement in a cookie "agree=True". But, while using MSXML2.XMLHTTP , I'm not able to set the cookie request header using setRequestHeader , so it redirects me to the usage agree page on every request. I know there's a bug using MSXML2 as stated here, but I don't see how I can use the workaround provided in the

VBA How to clear object before Exit Sub within With Object statement [duplicate]

ぃ、小莉子 提交于 2021-01-29 20:40:48
问题 This question already has answers here : When should an Excel VBA variable be killed or set to Nothing? (3 answers) Closed 6 months ago . I have used Exit Sub within With statement to avoid Set statement in below code. Will this clear the object or is there a way to do this? Dim FolderPathStr As String With CreateObject("Scripting.FileSystemObject") If .FolderExists(FolderPathStr) = False Then MsgBox "Folder does not Exist" Exit Sub End If End With 回答1: As the comments say, VBA has automatic

Online search bar values after export from excel not clicking automatically tag identify wrong

空扰寡人 提交于 2021-01-29 20:01:01
问题 I am exporting values from two cells online on a webpage which is running correctly. However, I have to manually press enter as Click is not automatically working in ElementbyId tag selection ("locationSearchTextBox"). After wards, I manually press enter and inspect element to import the elevation result back to excel. I need help in automating these final two steps. I am new in learning about tag classes, id name etc. Probably might be choosing wrong due to ignorance. Help is appreciated.

VBA looping through sheets removing duplicates

女生的网名这么多〃 提交于 2021-01-29 19:58:53
问题 I have seen similar things, but my code that seems to be working I just want to check for improvements or what potential bugs, unintended consequences there could be for it. I have been handed spreadsheets that have ended up getting duplicate information. There are a lot of spreadsheets, some have 100 sheets inside each file. Obviously don't want to go through each sheet manually using remove duplicate information. After searching around I think I have a solution and want your opinions on it.