Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Importing .csv file once daily leaves a data connection

I have a macro that imports a .csv file into Excel. This macro is run once
at night. I recently saw under Connections that each time we do an import,
it leaves a connection. So after importing the file for 3 nights, we have 3
connections. I don't believe I need these connections to remain. Each
night is a fresh import into different rows so we are not actually
refreshing the previous connection. How can I prevent these connections
from remaining after the import?

--
Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Importing .csv file once daily leaves a data connection

Without seeing your code its hard to say.

"Saucer Man" wrote:

I have a macro that imports a .csv file into Excel. This macro is run once
at night. I recently saw under Connections that each time we do an import,
it leaves a connection. So after importing the file for 3 nights, we have 3
connections. I don't believe I need these connections to remain. Each
night is a fresh import into different rows so we are not actually
refreshing the previous connection. How can I prevent these connections
from remaining after the import?

--
Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Importing .csv file once daily leaves a data connection

Here it is without the declares...

'Set rng = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
'With
ActiveSheet.QueryTables.Add(Connection:="TEXT;\\Da ta-store\UPS_CSV_EXPORT.csv",
Destination:=rng)
' .Name = "UPS_CSV_EXPORT"
' .FieldNames = True
' .RowNumbers = False
' .FillAdjacentFormulas = False
' .PreserveFormatting = True
' .RefreshOnFileOpen = False
' .RefreshStyle = xlInsertDeleteCells
' .SavePassword = False
' .SaveData = True
' .AdjustColumnWidth = False
' .RefreshPeriod = 0
' .TextFilePromptOnRefresh = False
' .TextFilePlatform = 437
' .TextFileStartRow = 1
' .TextFileParseType = xlDelimited
' .TextFileTextQualifier = xlTextQualifierDoubleQuote
' .TextFileConsecutiveDelimiter = False
' .TextFileTabDelimiter = False
' .TextFileSemicolonDelimiter = False
' .TextFileCommaDelimiter = True
' .TextFileSpaceDelimiter = False
' .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1)
' .TextFileTrailingMinusNumbers = True
' .Refresh BackgroundQuery:=False
'End With
'Set rng = Nothing

"Mike" wrote in message
...
Without seeing your code its hard to say.

"Saucer Man" wrote:

I have a macro that imports a .csv file into Excel. This macro is run
once
at night. I recently saw under Connections that each time we do an
import,
it leaves a connection. So after importing the file for 3 nights, we
have 3
connections. I don't believe I need these connections to remain. Each
night is a fresh import into different rows so we are not actually
refreshing the previous connection. How can I prevent these connections
from remaining after the import?

--
Thanks!





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Importing .csv file once daily leaves a data connection

I tried adding...

ActiveWorkbook.Connections("UPS_CSV_EXPORT").Delet e

and the connection is gone when viewed in the connections screen in Excel
2007. However, the next time I open the Excel document, the connection is
back again.

Also, the connections created when we run the macro daily are building up.
There is

UPS_CSV_EXPORT1
UPS_CSV_EXPORT2
UPS_CSV_EXPORT3
UPS_CSV_EXPORT4
UPS_CSV_EXPORT5
UPS_CSV_EXPORT6

Even removing these with the Connections dialog in Excel 2007 is only
temporary. They come back when we open the document the next time.



"Saucer Man" wrote in message
...
Here it is without the declares...

'Set rng = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
'With
ActiveSheet.QueryTables.Add(Connection:="TEXT;\\Da ta-store\UPS_CSV_EXPORT.csv",
Destination:=rng)
' .Name = "UPS_CSV_EXPORT"
' .FieldNames = True
' .RowNumbers = False
' .FillAdjacentFormulas = False
' .PreserveFormatting = True
' .RefreshOnFileOpen = False
' .RefreshStyle = xlInsertDeleteCells
' .SavePassword = False
' .SaveData = True
' .AdjustColumnWidth = False
' .RefreshPeriod = 0
' .TextFilePromptOnRefresh = False
' .TextFilePlatform = 437
' .TextFileStartRow = 1
' .TextFileParseType = xlDelimited
' .TextFileTextQualifier = xlTextQualifierDoubleQuote
' .TextFileConsecutiveDelimiter = False
' .TextFileTabDelimiter = False
' .TextFileSemicolonDelimiter = False
' .TextFileCommaDelimiter = True
' .TextFileSpaceDelimiter = False
' .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1)
' .TextFileTrailingMinusNumbers = True
' .Refresh BackgroundQuery:=False
'End With
'Set rng = Nothing

"Mike" wrote in message
...
Without seeing your code its hard to say.

"Saucer Man" wrote:

I have a macro that imports a .csv file into Excel. This macro is run
once
at night. I recently saw under Connections that each time we do an
import,
it leaves a connection. So after importing the file for 3 nights, we
have 3
connections. I don't believe I need these connections to remain. Each
night is a fresh import into different rows so we are not actually
refreshing the previous connection. How can I prevent these connections
from remaining after the import?

--
Thanks!








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
Importing data from daily worksheets into my annual report Sonia Marie[_2_] Excel Discussion (Misc queries) 2 July 27th 09 10:58 PM
Importing:Data Connection Wizard Doesn't see Source Data - No Impo Exotic Hadron Excel Discussion (Misc queries) 0 October 1st 08 07:35 PM
sdf file supported as data connection in Excel 2007? Molon Labe Excel Discussion (Misc queries) 0 April 2nd 08 11:06 AM
Extracting data from text file that changes daily mikerobe Excel Programming 4 March 20th 08 09:40 PM
always recheck data connection library for latest connection strin FurmanGG Excel Discussion (Misc queries) 0 September 14th 07 04:48 PM


All times are GMT +1. The time now is 02:55 PM.

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"