Hello everyone
I was wondering if anyone could point me in the right direction with workbook connections.
So...I have a connection which is from a text file. Using a button the user of my workbook will refresh this data by selecting the most recent text file from a list in a windows directory. The problem I am having is I would like to know what file the data is being drawn from.
To refresh the data I just use ActiveWorkbook.RefreshAll
I am able to extract the workbook connection name with the use of this:
The issue is that its not the connection name I want, its the data file name I want instead.Sub one() Dim conn As WorkbookConnection For Each conn In ActiveWorkbook.Connections MsgBox conn.name Next conn End Sub
If anyone can help then that would be brilliant. Thanks alot in advance
Hi
Does anyone have any ideas please?
Thanks
Can you clarify.
Your thread title explicitly says you want the connection name. Your penultimate sentence says otherwise
You mention a 'data file'. What's this?
Richard Buttrey
If this was useful then please rate it appropriately.
Click the small star iconat the bottom left of my post.
Hi, sorry to confuse, thought the title was clear.
I have imported data from a text file (csv) thats organised on a worksheet. This text file is named as a date, for example 01-01-2012.txt. When I initially set up the connection, I gave the connection a name of something like 'Route & call info'.
My workbook requires the user to refresh the connection every time they use it but the text file they refresh their data from could change. i.e. the text file may be replaced by 02-01-2012.txt. The connection name (Route & call info) always stays the same but the filename where the data is coming from changes.
Its the filename of the text file that is supplying the data that I want to capture.
Hope thats a little clearer?
Thanks
Last attempt at trying to resource the answer!...
Apologies if this is frowned upon here!...|
Kris
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks