Dave,
Thank you so much for responding to my query. After I submitted it, I found
many of the strings on cvs files and am still unable to read the cvs files.
I did run “excel / unregserver†and “excel / regserver†as you suggested,
and I got back “unregserver.xlsx could not be found. Check the spelling …….â€
after Excel opened. I registered my 2007 Office when I loaded it.
Following is the code I have used successfully in Excel 2003. It doesn't
run on Excel 2007.
I would appreciate any help you can give me.
Jim
'******************************************************
Function RowCountYX(ReferenceCell As String, RowOffset As Integer, ColOffset
As Integer) As Integer
'Returns the number of rows below the ReferenceCell (offset by ColOffset and
RowOffset)
'that are not blank. Note: Cell can contain calculation error to be counted.
Dim Blank As Boolean
RowCountYX = 0
Blank = False
Do
X = Range(ReferenceCell).Offset(RowOffset + RowCountYX + 1,
ColOffset).Value
If Not IsError(X) Then
If X = "" Then 'Check if cell is blank
Blank = True
RowCountYX = RowCountYX - 1
End If
End If
RowCountYX = RowCountYX + 1
Loop Until Blank
End Function
Sub LoadFundPrices()
Dim nRows As Integer
Dim CopyRange As String
Dim Name As String
Dim HomeSheet As String
Dim MainFile As String
HomeSheet = ActiveSheet.Name
MainFile = ActiveWorkbook.Name
Name = "C:\Junk\Funds.csv"
Workbooks.Open FileName:=Name 'fails with following message:
'c:\Junk\Funds.csv could not be found. Check the spelling.....
‘I checked and double checked the existence of the .csv file in c:\Junk.
nRows = RowCountYX("A1", 0, 0)
CopyRange = "A1:J" & Trim(Str(nRows))
Range(CopyRange).Select
Selection.Copy
Windows(MainFile).Activate
Sheets("DownLoad").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Windows("Funds.csv").Activate
Application.CutCopyMode = False
ActiveWindow.Close
End Sub