PC Review


Reply
Thread Tools Rate Thread

Open File, pause macro until file is selected

 
 
Jims
Guest
Posts: n/a
 
      6th Dec 2007

--
Jim
 
Reply With Quote
 
 
 
 
Jims
Guest
Posts: n/a
 
      6th Dec 2007
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

 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      6th Dec 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop / Pause a Macro using Pause button scott56hannah Microsoft Excel Programming 4 27th Jun 2008 12:48 PM
pause macro until command completed =?Utf-8?B?TWlrZUdpbk1u?= Microsoft Access Macros 1 19th May 2006 08:00 PM
Pause macro until form closes =?Utf-8?B?RG9yY2k=?= Microsoft Access Macros 4 18th May 2006 09:28 PM
pause macro until user selects correct range =?Utf-8?B?SkNJcmlzaA==?= Microsoft Excel Programming 6 18th Mar 2006 10:26 PM
macro pause until mouse click Pablo Microsoft Excel Misc 3 19th Mar 2004 02:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:15 AM.