Hi,
Any idea why the connection does not rename based on the code?
At the end of the import, I want to break the connection (delete it) so there is no reference to the source CSV file. By default the connection name is based on the csv file name, but this can change by month, so how does one delete the connection if I cannot rename it to a static name?
TX
CSV import connection not renaming?
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
CSV import connection not renaming?
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CSV import connection not renaming?
You don't need to know the name of the connection. You can delete it at the end of the With ... End With block:
Code: Select all
...
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
.Delete
End With
End Sub
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: CSV import connection not renaming?
Oh, and by the way: the line
does not set the name of the connection, but of the imported range.
Code: Select all
.Name = "SourceData"
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: CSV import connection not renaming?
TX for both those details. Important to know and working now...
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.