vba

Excel VBA click website button with no name or ID that uses JSON

北城余情 提交于 2021-02-11 17:39:33
问题 I am using excel VBA to open this website: Legal and General, Then it needs to click the "Fund prices and charges" button. Inspecting the web page with chrome, I can see this button has the following code: <div class=" selected tab" tabindex ="0" role="button" aria-pressed="true">...</div> The HTML 'view source' suggests a script type="application/JSON" I'm very confused by all of this. Does anyone know how I can select this button? I have this section of code so far: Set HTMLDoc = .document

adodb execute sql command timeout

无人久伴 提交于 2021-02-11 17:27:27
问题 I have this code below and it is hanging on me. It worked fine for several files...but it is now hanging on me and times out with error (-2147217871:Query timeout expired). 'This is what it looks like in SQL Server when I print the string in the immediate window: BEGIN TRAN; INSERT INTO [dbo].[XLSHdr] WITH(TABLOCK) ([HdrID],[TabName],[FileHyperLink],[FileName],[DocumentType],[EmailID],[Subject],[SentDate],[AttachmentName],[TextFileLink],[DateReceived],[Vendor],[ContactName],[ContactNumber],

Redraw a UserForm in VBA

…衆ロ難τιáo~ 提交于 2021-02-11 17:25:49
问题 I have a userform in VBA and I'd like to redraw/update it in the middle of a method. When the method is called on button click, the function is as below: UsrForm.Field1.Value = "" UsrForm.Field2.Value = "" UsrForm.Label1.Caption = "LOADING..." /*Processing occurs*/ UsrForm.Field1.Value = val1 UsrForm.Field2.Value = val2 UsrForm.Label1.Caption = "DONE" However, the update to the form visible only occurs when the method is completed. I get val1, val2, and "DONE" but not the "LOADING..." message

Cancel Option GetOpenFilename(Multiselect:= True)

為{幸葍}努か 提交于 2021-02-11 17:21:59
问题 I have the following question: when I use the GetFileOpenFileName option with Multiselect = True it returns the results as a Array if I selected one file or more, but if I click "Cancel" it returns as a boolean vartype. What should I do to avoid the error 13 "Incompatible Type when someone clicks it. Besides, I already tried to test if(vartype(filename) = vbBoolean) then or if(filename = False) then to exit sub, but the first one I took the same error and the second one it said that I'm not

Moving files to another directory

老子叫甜甜 提交于 2021-02-11 17:19:45
问题 I am trying to move several thousand documents from a list in one column and then move them to the folders listed in the other column, and then finally a third column with what has been moved and what hasn't (there will be errors where the file doesn't exist. I know how to do it on a file by file basis as below: How do I do it for the whole columns though? Sub Copy_One_File() FileCopy "C:\Users\Ron\SourceFolder\Test.xls", "C:\Users\Ron\DestFolder\Test.xls" End Sub Sub Move_Rename_One_File()

Pass Python Argument Through VBA

本秂侑毒 提交于 2021-02-11 17:08:41
问题 I have written a python script that needs to be called using VBA. I have written a python script that can parse through a pdf, store the data I need in variables, and write to a pre-made excel sheet to fill in the cells with those values. I have successfully been able to call that script and run it using the following code: Sub RunPythonScript() 'Declare Variables Dim objShell As Object Dim PythonExe, PythonScript As String 'Create a new Object shell. Set objShell = VBA.CreateObject("Wscript

Pass Python Argument Through VBA

点点圈 提交于 2021-02-11 17:07:39
问题 I have written a python script that needs to be called using VBA. I have written a python script that can parse through a pdf, store the data I need in variables, and write to a pre-made excel sheet to fill in the cells with those values. I have successfully been able to call that script and run it using the following code: Sub RunPythonScript() 'Declare Variables Dim objShell As Object Dim PythonExe, PythonScript As String 'Create a new Object shell. Set objShell = VBA.CreateObject("Wscript

VBA Excel border around the picture

ぐ巨炮叔叔 提交于 2021-02-11 16:52:30
问题 Good morning, Precision my question from yesterday: VBA Excel border around the specified picture I would like to make automatic borders for most of the images in my Excel document. I started to record the macro, which looks like this: Sub Picbodred() ' ' Picbodred Macro ' ' ActiveSheet.Shapes.Range(Array("Picture 2")).Select With Selection.ShapeRange.Line .Visible = msoTrue .ForeColor.RGB = RGB(0, 0, 0) .Transparency = 0 End With End Sub But it covers 1 image only, and as it worst this image

Offset the Copy Row as part of a Loop

家住魔仙堡 提交于 2021-02-11 16:51:34
问题 I have written the below code but i would like the macro to repeat this process, copying the next row down in the SS21 Master Sheet until that row is blank (the end of the table). Something like this? Sub Run_Buysheet() Sheets("SS21 Master Sheet").Range("A1:AH1, AJ1:AK1, AQ1").Copy Destination:=Sheets("BUYSHEET").Range("A1") Sheets("SS21 Master Sheet").Range("A2:AH2, AJ2:AK2, AQ2").Copy Destination:=Sheets("BUYSHEET").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) Dim r As Range, i As Long,

Offset the Copy Row as part of a Loop

随声附和 提交于 2021-02-11 16:50:13
问题 I have written the below code but i would like the macro to repeat this process, copying the next row down in the SS21 Master Sheet until that row is blank (the end of the table). Something like this? Sub Run_Buysheet() Sheets("SS21 Master Sheet").Range("A1:AH1, AJ1:AK1, AQ1").Copy Destination:=Sheets("BUYSHEET").Range("A1") Sheets("SS21 Master Sheet").Range("A2:AH2, AJ2:AK2, AQ2").Copy Destination:=Sheets("BUYSHEET").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) Dim r As Range, i As Long,