Re: With excel 2003 could open .csv file but not in excel 2007.
- From: Dave Peterson <petersod@xxxxxxxxxxxxxxxx>
- Date: Mon, 26 Nov 2007 14:59:42 -0600
First, I didn't know that you were using code to open your .csv files. I
assumed that the problem was occurring when you double clicked on the file name
in windows explorer.
And even though re-registering excel won't help your code, you didn't follow the
instructions close enough.
Close excel
windows start button|Run
excel /unregserver
windows start button|Run
excel /regserver
There is a space character after Excel and then no space embedded in
/unregserver and no space in /regserver.
As for your code, I bet you don't have a file named:
C:\junk\funds.csv
I'd double check--and make sure you're looking at all the the filename--maybe
you have the extension hidden (it's a windows option).
The real filename could be:
C:\junk\funds.csv.xls
(or any other known extension)
But you're not seeing that last extension.
TexPop wrote:
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 Home*** As String
Dim MainFile As String
Home*** = Active***.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
"Dave Peterson" wrote:
I'd reregister excel
Close excel
windows start button|Run
excel /unregserver
windows start button|Run
excel /regserver
If that doesn't help, you may want to provide more info--what you did and what
happened when you did it?
TexPop wrote:
I have succesfully downloaded .csv files with a macro in my Excell 2003 for
years, but that macro no longer works. I can't even open a .csv file with
Excel. Any suggestions.
--
Dave Peterson
--
Dave Peterson
.
- Follow-Ups:
- References:
- Re: With excel 2003 could open .csv file but not in excel 2007.
- From: Dave Peterson
- Re: With excel 2003 could open .csv file but not in excel 2007.
- From: TexPop
- Re: With excel 2003 could open .csv file but not in excel 2007.
- Prev by Date: RE: how can I get the work*** with the pivottable sourcedata when wo
- Next by Date: Re: Using "Paste" Method in VBA
- Previous by thread: Re: With excel 2003 could open .csv file but not in excel 2007.
- Next by thread: Re: With excel 2003 could open .csv file but not in excel 2007.
- Index(es):