I've got a workbook, Orders2015.xlsm that is populated by a Microsoft Query, and I want a messagebox to pop up when you open it, asking if you want to refresh the data. I don't know much about VBA so I googled it and now have this in ThisWorkbook:
Private Sub Workbook_Open()
Dim Msg, Style, Title, Response
Msg = "Do you want to refresh the order list?"
Style = vbYesNo
Response = MsgBox(Msg, Style)
If Response = vbYes Then
Sheets("Orders").Select
ActiveWorkbook.RefreshAll
Exit Sub
End If
End Sub
Which does work, however it is causing Orders2015.xlsm to open when I open other workbooks as well. Can anyone tell me what I've done wrong?
Thanks in advance.
Bookmarks