View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] HB_temp@aapt.net.au is offline
external usenet poster
 
Posts: 3
Default rows.count property returns 2 even though only 1 row was imported by querytables.add

Environment:
Win7 Home Premium SP1
MS Office Home 2010
Excel 14
VBA for Applications 7.0

Importing a single-line text file with the following

Set qrytable = ActiveSheet.QueryTables.ADD(Connection:="TEXT;" + csvFile, ...)

With qrytable
.Refresh BackgroundQuery:=False
nValues = .ResultRange.Rows.Count
End With

produces nValues=2 from the Rows.Count property. If there's more than one line in the file, Rows.Count is indeed correct.

Anyone else seen this behaviour ?