LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default ThisWorkbook.Path not updating

I run the following code to retrive data from a database which is in the same
directory as my workbook. The file travels between computers into different
directories so I am using ThisWorkbook.Path to update the path.

This works 98% of the time. However occaisionally it doesn't update and
remembers the prior path (on the last machine) it refreshed to. I have no
idea why.

Can I add something to force this?

Bruce

Private Sub myEOD()

pathA = ThisWorkbook.Path & "\ASX.mdb"
pathB = ThisWorkbook.Path
a = "ASX_EOD"

With Worksheets(a).Range("A1").QueryTable
.Connection = _
"ODBC;DSN=MS Access Database;DBQ=" & pathA & _
";DefaultDir=" & pathB & ";DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;"
.CommandText = Array( _
"SELECT ASXCode, Open, High, Low, Close, Volume, ImportDate" &
Chr(13) & "" & Chr(10) & _
"FROM qry_ASX_EOD" & Chr(13) & "" & Chr(10) & _
"ORDER BY ASXCode")
.FillAdjacentFormulas = True
.Refresh BackgroundQuery:=False
End With
End Sub

 
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
Excel updating from XML file - file path specific? Sean Excel Discussion (Misc queries) 4 August 5th 05 12:56 PM
Link path not updating when renamed Ausrobbo Excel Discussion (Misc queries) 0 January 17th 05 09:21 AM
ThisWorkbook.Path & "\" & .... not WAVFile, but AVI file... ste mac Excel Programming 0 May 31st 04 10:22 AM
ThisWorkbook.Path Birdy Excel Programming 1 February 10th 04 02:50 AM
Custom Footer using ThisWorkbook.Path? debartsa Excel Programming 2 November 4th 03 01:47 PM


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

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

About Us

"It's about Microsoft Excel"