Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.links
external usenet poster
 
Posts: 3
Default Changing External Data Location

I have a fairly complex workbook that I used on a regular basis. The
first thing it does is get a data extraction from an ACCESS database
that is located on a different computer over the LAN using MSQuery.

Recently, my IT department swapped out the computer that stored the
ACCESS database with a different computer (new name, new IP address,
etc.). So now even though the database structure is the same it's
stored on a new machine.

How can I change the location that the link uses to retrieve the data.
  #2   Report Post  
Posted to microsoft.public.excel.links
external usenet poster
 
Posts: 473
Default Changing External Data Location

Try this macro.
Open your workbook and have it active when you run the macro.

Sub ChangeQuerys()
Dim stFrom As String
Dim stTo As String
Dim QT As QueryTable
Dim WS As Worksheet
stFrom = InputBox("Old database path (excluding \filename.mdb)?")
stTo = InputBox("New database Path (excluding \filename.mdb)?")
For Each WS In ActiveWorkbook.Worksheets
For Each QT In WS.QueryTables
QT.Connection = Application.Substitute(UCase(QT.Connection),
UCase(stFrom), stTo)
QT.Sql = Application.Substitute(UCase(QT.Sql), UCase(stFrom),
stTo)
QT.Refresh
Next
Next
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Query to get external data Andyjim Excel Discussion (Misc queries) 1 February 1st 08 07:23 PM
Change the location of external data feeding a pivottable Mark Parent Excel Discussion (Misc queries) 4 January 3rd 08 10:20 PM
macro help for changing data (cell location) in edit find box Jim Excel Discussion (Misc queries) 1 November 10th 06 10:57 PM
Import External Data Source File Location Changed Louise Excel Discussion (Misc queries) 3 January 4th 06 02:47 PM
import external data from changing file name nathan Excel Worksheet Functions 2 April 6th 05 04:39 PM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"