Brain Scratcher! Variable Speed Macro

dyaron

Active Member
Joined
Nov 26, 2007
Messages
291
All, this one came to me in my sleep...

So I have a call statement that runs several macros... around 30 different ones all utilizing the on-time function. YES, I do need the on-time function based on server side authentication. However, my question is based on my internet connection. If I run my program when I'm at home, with a steady internet connection, my current On-Time intervals (every 4 seconds) works ok, because the response from the server is fast enough... but, let's say I'm at an internet cafe, or something like that, where the internet isn't the "fastest", I need to change the speed interval to ever 10 seconds. Is there a way for me to write some sort of statement that gets the Speed/Status/Signal Strength of the local area connection data to say for instance...

if signal strength = "Excellent", then time intervals = 4 seconds else,
if signal strength = "Poor", then time intervals = 10 seconds

Just wanted to know if this is even possible?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You could implement some sort of use for ping (google ping + vba)to calculate latency and based on that change your interval.

Perhaps easier (and way less code to write) would be to have a manual option i.e. use an inputbox or user form to ask for conection speed between 2 arbritary numbers such as 1-5 and then based on that change the the interval using case

eg

select case webspeed of
1 then set interval to 10
2 then set interval to 8
...
(pseudocode only)
 
Upvote 0
I was thinking of doing your second suggestion already, the only problem is, there are some instances in which the macros are kicked off via MS task scheduler, when I'm not near my computer. So I think your first suggestion would be more feasible. Is there a Ping() function? Can you give me an example? Thanks!
 
Upvote 0
There isnt an actual function in VB as such, but there are various solutions out there as I said try googling ping + vba to have a look.

You could also try using some code to download a file from a server several times and average out the time to download and use that.

I cant give you specific code but if you look for vba binary file download you should be able to find something
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,384
Members
448,956
Latest member
JPav

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