![]() |
Open File, pause macro until file is selected
-- Jim |
Open File, pause macro until file is selected
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 |
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 |
All times are GMT +1. The time now is 02:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com