View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Open File, pause macro until file is selected

You can replace Arrray wirth a variable like shown below. You can set
myarrray to different string depending on which table is selected by the user.

Sub Macro1()

ChDir "C:\Scc\db"
myArray = Array("UsageReport1"),
Workbooks.OpenDatabase Filename:="C:\Scc\db\db1.mdb",
CommandText:=myArray, CommandType:=xlCmdTable
End Sub

"Jims" wrote:

Sorry, my post was not complete.

I have recorded macro that goes to a specifc directory and opens a Access DB
and then I select the table and it is populated to my spreadsheet.
Whta I want to be able to do is, once thee table window opens allow the user
to select the table they want to import and then finish running hte macro.

The Macro;



Sub Macro1()

ChDir "C:\Scc\db"
Workbooks.OpenDatabase Filename:="C:\Scc\db\db1.mdb",
CommandText:=Array( _
"UsageReport1"), CommandType:=xlCmdTable
End Sub
--

Jim


"Jims" wrote:


--
Jim