O
OverMyHead
I have an Excel spreadsheet that queries an access database. Part of the
macro I have created (with the help of a co-worker) has the database import
information from a different spreadsheet. When this happens it opens a prompt
that asks for a date. How do I make it so that pop up window is in focus?
Below is the code I believe is relevant to the problem.
Sub Refresh_Access()
Dim LOC As String
LOC = "\\kftwmfs02\Departments\Dispatch\Shared_Files\Capatalized
Work\Capitalized Work.mdb"
Call Module1.Create_Shell_Access(LOC)
End Sub
Module1:
Public Function Create_Shell_Access(ByVal Location As String)
Dim accs As New Access.Application
Set accs = CreateObject("Access.Application")
accs.Visible = False
accs.OpenCurrentDatabase Location
'Set accs = Nothing
Call Module2.Refresh
End Function
Module2:
Sub Refresh()
'
' Refresh Macro
'
' Keyboard Shortcut: Ctrl+r
'
Sheets("Capitalized Work By Area").Select
Range("A4").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Range("A6").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Range("A8").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
macro I have created (with the help of a co-worker) has the database import
information from a different spreadsheet. When this happens it opens a prompt
that asks for a date. How do I make it so that pop up window is in focus?
Below is the code I believe is relevant to the problem.
Sub Refresh_Access()
Dim LOC As String
LOC = "\\kftwmfs02\Departments\Dispatch\Shared_Files\Capatalized
Work\Capitalized Work.mdb"
Call Module1.Create_Shell_Access(LOC)
End Sub
Module1:
Public Function Create_Shell_Access(ByVal Location As String)
Dim accs As New Access.Application
Set accs = CreateObject("Access.Application")
accs.Visible = False
accs.OpenCurrentDatabase Location
'Set accs = Nothing
Call Module2.Refresh
End Function
Module2:
Sub Refresh()
'
' Refresh Macro
'
' Keyboard Shortcut: Ctrl+r
'
Sheets("Capitalized Work By Area").Select
Range("A4").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Range("A6").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Range("A8").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False