VBA open URL and run timer

Donb209

New Member
Joined
Apr 30, 2020
Messages
13
Office Version
  1. 365
Platform
  1. Windows
I have a financial program in excel with almost all activity driven by ActiveX controls. At some point I access my banks web site (no login, just open URL, or my credit cards website) which takes at least a 1 to 2 minutes. For a user like myself, we get very concerned as to status with such a long time. By The way - if it is not a bank or other financial institution, it only takes about 2 to 3 seconds. I assume that the security software at the financial sites do some rather lengthy scans before allowing this connection. Anyway, I have a userform message and a graph showing seconds passing by while the web site is opening, as a pacifier.
Problem: the timer and message is in a userform and they won't start until the URL access is completed (open AND closed). How can I have the URL accessed in the background until open and the userform with timer run in the foreground until then, or is it not possible??
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi

Would it not be an option to have the userform open up, then have a form button to do run your code, but before the code runs start your timer 1st.

It sounds like things are just happening in the wrong order, unless i have mis-understood your question.

Sometimes when i have had things where i need a status or timer, i have used the status bar to display the information.
VBA Code:
Application.StatusBar = "my-status"
 
Upvote 0
Hi

Would it not be an option to have the userform open up, then have a form button to do run your code, but before the code runs start your timer 1st.

It sounds like things are just happening in the wrong order, unless i have mis-understood your question.

Sometimes when i have had things where i need a status or timer, i have used the status bar to display the information.
VBA Code:
Application.StatusBar = "my-status"
 
Upvote 0
Good thought, but I do get the userform open and have a button to start the timer. But the timer has to run while the browser is working to open the URL This means that I have to jump out of the timer which increments every second to start the browser, and once I start the browser, all action in VBA stops until the browser is complete and I have exited the URL. I activate the browser with this code:
ThisWorkbook.FollowHyperlink ("PNC Bank")
I'm guessing that I need the timer running in VBA and the browser opening at the Windows level. I don't see how I can have 2 VBA macros running at the same time. Do you know a better way to kick the browser into action then breaking out of it until it brings the website up on the screen?
 
Upvote 0
Hi

So not exactly sure how your code is set out etc.

But below is a very simple code.

drop this into a balnk workbook and give it a try, im not sure if this is of any help to you, but this shows you you can have a timer running while while you execute other code.

if you then run the timer macro, A2 should start upadting every second.

but at the same time you can run macro 1 manually while the timer is running.

im sure i have done something very similar to what you are trying to do, but its all about how you structure the code.

VBA Code:
Sub TIMER1()
If Range("a1") = "s" Then Exit Sub
Application.OnTime Now + TimeSerial(0, 0, 1), "TIMER1"
Range("a2") = TimeValue(Now)
End Sub
Sub macro1()
Range("a3") = Range("a3") + 1
End Sub
 
Upvote 0
Thanks Squidd but, I short cut the problem definition a little. My timer works good. I modified a code I got from wellsr.com for a progress bar. The real problem is that I update some data in my financials and need to perform the same in my bank at some times. I use a form (so it looks nice) to ask if the user (me, or spouse) wants to update the bank at this time. The yes answer opens the Chrome browser to the bank web site. Since it takes about a minute or so to open I set up the progress bar to show the progress of time passing while waiting. This is to pacify myself that things are functioning. I come from the (BSOD) era, and worry that I have an endless loop going somewhere. The problem lies not in the starting or functioning of the progress bar, but in the fact that opening Chrome takes over the screen and I can't see the userform with the progress bar anymore. I need to keep Chrome in the background until open or in another window , or have the userform stay on top of everything else until I dismiss it. I am a self taught Excel and VBA person that comes from the old days of DOS and all forms of Basic with some Fortran and PHP but, OOP parts of VBA still confuse me somewhat. For that reason I can't find a way to show the progress bar while the web site is opening. I am retired so I don't do this for anyone but myself and I don't plan on anyone but immediate family using it. I just want it to look nice and be simple to manage finances as I get older. Thank you for the help. If you tell me how to do it, I will attach the simple 1 sheet - work book with the code. The workbook has one sheet with an ActiveX commandButton to kick off the whole thing. It also has one userForm and one module with several macros in it.
Thanks again!
 
Upvote 0
Ok. I see. So I have not myself used chrome. Although am am about to build a data scraper using it I hope.

Surely there is a way to bring back the user form to the front. Like userform.show. Maybe it needs to be “userform.show vbmodeless”

with internet explorer you used to be able to open internet explorer without showing it. Then you could call it to show later.
It’s all a long shot to be honest from me.
But if I discover something I will let you know.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,582
Members
449,089
Latest member
Motoracer88

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