Other Everything else not covered in the main topics goes here. Please avoid brand and flame wars. Don't try and up your post count. It won't work in here.

Microsoft Excel - updating external data

Thread Tools
 
Search this Thread
 
Old 01-28-2006, 03:22 PM
  #1  
Registered User
Thread Starter
 
AggieJustin's Avatar
 
Join Date: Jul 2002
Location: Celina, TX
Posts: 2,242
Received 16 Likes on 13 Posts
Microsoft Excel - updating external data

Where are our Microsoft Office gurus?? Got a question for you...

I'm working on a Microsoft Excel 2002 workbook that contains a number of external data ranges that are pulled in using SQL queries from an Oracle database. The workbook is basically a summary view of data related to a project, and I'll be using this workbook against many different databases.

I've got the queries all working and I can get the data pulled in, but I'm looking for an easier method to update all of the ranges automatically. Right now, I have all of the ranges set to not remember the password so that I can update the target database for the range each time I refresh. If I use the Refresh All function from the External Data toolbar, it will prompt for the user info for each range (and there will probably be about 50-60 ranges in the book). What I'd want is for it to prompt once, then use that login info for each range in the workbook. This would make it easy to point the workbook at a new database, and update the entire thing with data from the new database.

Any ideas? I'm guessing I'll have to put together a macro to grab the login info and pass it to the refresh command, but I don't have much experience with VB. So any help you guys could provide would be much appreciated.

Justin
Old 01-28-2006, 05:16 PM
  #2  
Registered User
 
grantx5's Avatar
 
Join Date: Aug 2005
Location: Puyallup, WA
Posts: 508
Likes: 0
Received 0 Likes on 0 Posts
Oracle is going to see each data fetch as a separate session so not much you can do about the userid/password entry.

VBA is easy to use and if you do a little research I think you'll find that writing some code to accomplish your work is pretty easy.

Take a look at:
http://www.dicks-clicks.com/excel/Ex....htm#CreateVBA

also see:
http://support.microsoft.com/default...b;en-us;306125

Good luck.
Old 01-29-2006, 08:42 AM
  #3  
Registered User
Thread Starter
 
AggieJustin's Avatar
 
Join Date: Jul 2002
Location: Celina, TX
Posts: 2,242
Received 16 Likes on 13 Posts
Thanks for the links Grant. So I've switched up my method so that the VB code is creating the connections and contains the queries as shown in the examples. Works much better as I can use prompts to get the user/password/database info from the user at the beginning, then substitute it into the connect line for each query. This way I just enter it once and let it run.

Now I just have to figure out how to get my form and my code to play together. I was satisfied having 3 prompts pop up that grab one piece of info at a time, so I created a form to capture everything in one window. The form looks nice, I just have to do some learning to figure out how to get it to pass the data back to the code to use in execution.

Back to the internet...sure wish I was at home where I could pick up a VB book.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
wyododge
Other
4
08-18-2011 07:48 AM
hamilton71801
Other
4
10-17-2008 07:10 PM
EKUgrad
Other
6
07-30-2007 08:41 AM
Grim Reaper
General Diesel Discussion
6
03-20-2006 12:31 PM
sdscuba
Other
3
09-04-2003 04:48 PM



Quick Reply: Microsoft Excel - updating external data



All times are GMT -5. The time now is 03:30 PM.