Macro to increment URL-based counter?

Audiology

Board Regular
Joined
Mar 4, 2009
Messages
171
We have a number of individuals entering student test data into a complex Excel 2010 spread sheet. Each child is assigned a unique study number 1 - 9999.

I originally had a macro that would increment a desktop counter via the local network each time a student's basic data was entered into its own workbook file (one per student).

Code:
Sub ID_Counter()
 Dim s As String, count As Long
 s = "C:\Documents and Settings\All Users\Desktop\Counter.txt"
 count = ReadCounter(s)
 
 IncCounter (s)
 count = ReadCounter(s)
 Sheets("SDC").Range("F44").Value = count
End Sub

Sub IncCounter(toFile As String)
  Dim iHandle As Integer, counter As Long
  On Error Resume Next
  counter = ReadCounter(toFile)
  iHandle = FreeFile
  Open toFile For Output Access Write As #iHandle
  Print #iHandle, counter + 1
  Close #iHandle
End Sub

Function ReadCounter(filePath As String) As Long
  Dim str As String, hFile As Integer
  On Error Resume Next
  hFile = FreeFile
  Open filePath For Binary Access Read As #hFile
  str = Input(LOF(hFile), hFile)
  ReadCounter = str
  Close hFile
End Function

Until recently, this worked fine, providing the next available student number to be assigned. When entered, the counter would increment +1. Problems arose because some, on site, were using Excel 2003 and others Excel 2010 when the naming/path conventions for "desktop" changed.

A new wrinkle now has some entering data offsite , off-network.

Is there a way to convert this macro to FTP the latest available student number to a common web page? I have access to a fixed IP address.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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