Using chrome with send keys

Spikehunter

New Member
Joined
Sep 27, 2023
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have built a spreadsheet that uses the follow hyperlink method to load a Web page. Works well except for one small glitch. If chrome is not open the "send keys" doesn't work, even though I can do it manually, and with a delay of 60 seconds. The next time I try it works perfectly and also for other associated pages. It's as though something isn't being set first time through the page loading. My programming experience is from the 70's so not quite up to date. I have a workaround but its not very elegant and I don't want to use IE.
Any suggestions gratefully received as I have tried many thoughts and other ideas.

Sub Update_IG_Availability_Data()
'
' Paste_New_Data Macro
'
On Error GoTo Error_Routine
Application.CutCopyMode = False
Call ClearClipboard


Dim URL As String
URL = "https://address"
ActiveWorkbook.FollowHyperlink URL

Application.Wait (Now() + TimeValue("00:00:15")) 'has been tested upto 55 seconds

SendKeys ("^a^c")

ThisWorkbook.Sheets("InputData").Activate
Range("A1:D4").Select

AppActivate ActiveWindow.Caption

CarryOn = MsgBox("Do you want to Paste the new data?", vbYesNo, " Availability")
If CarryOn = vbYes Then
CheckClipboard
ActiveSheet.Paste Destination:=Worksheets("InputData").Range("A1")
End If

CarryOn = MsgBox("Do you want to update the data?", vbYesNo, "BBGC")

If CarryOn = vbYes Then
UpdateAvailability
End If

Range("A1").Select


Exit Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error_Routine:
'MsgBox ("You have an error, Have you copied the IG Data before running")

CarryOn = MsgBox("Do you want to try again", vbYesNo, "Burnham & Berrow Golf Club Availability")

If CarryOn = vbYes Then
Update_IG_Availability_Data
End If
End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top