• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 693
  • Last Modified:

Excel Data connections to a SQL DB

So I have an excel sheet (xlsm) that technicians use out in the field that is tied to a SQL DB through Excel's data connections populating and refreshing the tables each time it is opened. The issue I have is, when the user opens the file with no Internet connection, it times out, and then populates with questions about the data links, that the users would not understand.

So my question is, when openeing the file, I want to have a question pop up and ask if the user is on-line or off-line? If the answer is on-line, then refresh the data connections. If the user states no, then do nothing with the data connections.

I understand I need to take out the refresh data connections at opening.

So how can I do this through a VB script in the Private Sub Workbook_Open()   ???
  • 2
1 Solution
Jagdish DevakuSr DB ArchitectCommented:

I hope this link will help you.


Jagdish D.
BKennedy2008Author Commented:
The button for refresh all connections........if I knew how to trigger that, then I would be golden and not have to rewrite all the data connections and bind them to a table.

Any ides?
Rory ArchibaldCommented:
If Msgbox("Are you online?", vbyesno) = vbyes then thisworkbook.refreshall

Open in new window

BKennedy2008Author Commented:
Thanks, that was too easy. I just caught it myself...

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now