Guys,
Here is the solution to my problem in case you need it.
I finally figured it out!
This code goes on a Module:
VB:
Dim X As New Class1
Sub Initialize_It()
Application.DisplayAlerts = False
Application.ScreenUpdating = True
diropen = "C:\Documents and Settings\jsoto\Desktop\"
Workbooks.Open diropen & "Test.xls" _
, UpdateLinks:=0
Set X.qt = Workbooks("Test.xls").Sheets("Sheet1").QueryTables(1)
ActiveWorkbook.RefreshAll
End Sub
This code goes on a Class Module:
VB:
Public WithEvents qt As QueryTable
Private Sub qt_AfterRefresh(ByVal Success As Boolean)
Dim a As Integer
Dim My_Prompt As String
My_Prompt = "Data refreshed."
If a = vbNo Then
My_Prompt = "Data will not be refreshed."
Cancel = True
End If
MsgBox My_Prompt
ActiveWorkbook.Save
Workbooks("Test.xls").Close
End Sub
Have fun!!
Bookmarks