# Brain Scratcher! Variable Speed Macro

#### dyaron

##### Active Member
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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### dyaron

##### Active Member
Bump... any takers?

#### random_noise

##### Active Member
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)

#### dyaron

##### Active Member
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!

#### random_noise

##### Active Member
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

Replies
2
Views
628
Replies
3
Views
118
Replies
2
Views
2K
Replies
26
Views
4K
Replies
1
Views
716

1,191,671
Messages
5,987,956
Members
440,121
Latest member
eravella

### 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.

### Which adblocker are you using?

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

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