Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

[noobish] Use an external datasource to check values in a program using VB?

  • 15-03-2012 01:17PM
    #1
    Registered Users, Registered Users 2 Posts: 14,163 ✭✭✭✭


    I have a macro in a program we use here at work that is checking for codes on the screen. This all works fine but as its on a number of systems in here if a new code is added at the minute it means manually editing the code on everyones computers.

    I was wondering as we have a sharedrive could a word document or notepad (or anything that sups can edit) that can be updated by anyone with new codes. Can this be used as a datasource where my code would look at it to see if the data on screen matches data in the document?

    sample of the code is below

    Sub Reminder()
    Dim dc1 As String 'code
    dc1 = Application.GetText(9, 11, 9, 19) 'xy coords of screen
    If (dc1 = "123456789" Or dc1 = "987654321") then
    Msg = "MESSAGE WILL GO HERE"
    Style = vbOKOnly + 48
    Title = "Interest Reminder!"
    Response = MsgBox(Msg, Style, Title)

    End If
    End Sub

    So you can see dc1 is looking for the number in the code itself so with number of computers each one would have to be manually updated on each one each time there was a new code, so you can see that a single external source would make the process a lot easier?


Advertisement