open CSV.file

I have a lot of csv file, in that file the date column contain both text and 
date values, but when i change my system settings to UK and if i manually 
change the date format using custom type "dd-mmm-yy", all the date and text 
value of that column will easily change to dd-mmm-yy, but when i created a 
macro to do the same thing, the problem iam facing here is when it open  each 
csv files the date is getting changed(the column contains both text and date 
values)


when i open the file using the below code it opens the file in a actual 
format(date values will not change)

ChDir "C:\Ranjith Report\FGA DEBT\Raw"
Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"

but when i open the file using the below code it opens in a different 
format(date value changes)

arrWorkBook = Array("ABC.csv","DEF.csv")
Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" & 
arrWorkBook(intTemp)
0
Utf
12/18/2009 9:46:01 AM
excel.programming 6508 articles. 2 followers. Follow

15 Replies
960 Views

Similar Articles

[PageSpeed] 16

I'm surprised that there was any difference in the way the data was treated.

In my simple tests (using USA date settings (mdy order)), both worked the same
way.

But (if I recall correctly), opening CSV files via code will use USA settings.

I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
or in code) and use .opentext to open the file(s).  Then I could specify each
field the way I wanted.

I'd be very concerned about date fields coming in as date fields--but not
representing the date in the actual source (01/02/03 could come in as Jan 2,
2003 or Feb 1, 2003 or ...).  

I'd want to make sure all the ambiguous dates would be brought in correctly.

Ranjith Kurian wrote:
> 
> I have a lot of csv file, in that file the date column contain both text and
> date values, but when i change my system settings to UK and if i manually
> change the date format using custom type "dd-mmm-yy", all the date and text
> value of that column will easily change to dd-mmm-yy, but when i created a
> macro to do the same thing, the problem iam facing here is when it open  each
> csv files the date is getting changed(the column contains both text and date
> values)
> 
> when i open the file using the below code it opens the file in a actual
> format(date values will not change)
> 
> ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> 
> but when i open the file using the below code it opens in a different
> format(date value changes)
> 
> arrWorkBook = Array("ABC.csv","DEF.csv")
> Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> arrWorkBook(intTemp)

-- 

Dave Peterson
0
Dave
12/18/2009 1:00:57 PM
Hi Dave, 

Thanks for your informations.

As you said in the below that its better to convert the .csv file to .txt 
file, the problem here is the txt file allways separate the columns based on 
Comma, so suppose if there are two columns like  Names and Amounts, and if 
any name contain comma, the name will be separated to next column where 
amount was suppose to be.

"Dave Peterson" wrote:

> I'm surprised that there was any difference in the way the data was treated.
> 
> In my simple tests (using USA date settings (mdy order)), both worked the same
> way.
> 
> But (if I recall correctly), opening CSV files via code will use USA settings.
> 
> I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> or in code) and use .opentext to open the file(s).  Then I could specify each
> field the way I wanted.
> 
> I'd be very concerned about date fields coming in as date fields--but not
> representing the date in the actual source (01/02/03 could come in as Jan 2,
> 2003 or Feb 1, 2003 or ...).  
> 
> I'd want to make sure all the ambiguous dates would be brought in correctly.
> 
> Ranjith Kurian wrote:
> > 
> > I have a lot of csv file, in that file the date column contain both text and
> > date values, but when i change my system settings to UK and if i manually
> > change the date format using custom type "dd-mmm-yy", all the date and text
> > value of that column will easily change to dd-mmm-yy, but when i created a
> > macro to do the same thing, the problem iam facing here is when it open  each
> > csv files the date is getting changed(the column contains both text and date
> > values)
> > 
> > when i open the file using the below code it opens the file in a actual
> > format(date values will not change)
> > 
> > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > 
> > but when i open the file using the below code it opens in a different
> > format(date value changes)
> > 
> > arrWorkBook = Array("ABC.csv","DEF.csv")
> > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > arrWorkBook(intTemp)
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/18/2009 2:13:01 PM
could you tell me how exactly can i convert the csv file to text file and 
again bring back to excel through macro

"Dave Peterson" wrote:

> I'm surprised that there was any difference in the way the data was treated.
> 
> In my simple tests (using USA date settings (mdy order)), both worked the same
> way.
> 
> But (if I recall correctly), opening CSV files via code will use USA settings.
> 
> I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> or in code) and use .opentext to open the file(s).  Then I could specify each
> field the way I wanted.
> 
> I'd be very concerned about date fields coming in as date fields--but not
> representing the date in the actual source (01/02/03 could come in as Jan 2,
> 2003 or Feb 1, 2003 or ...).  
> 
> I'd want to make sure all the ambiguous dates would be brought in correctly.
> 
> Ranjith Kurian wrote:
> > 
> > I have a lot of csv file, in that file the date column contain both text and
> > date values, but when i change my system settings to UK and if i manually
> > change the date format using custom type "dd-mmm-yy", all the date and text
> > value of that column will easily change to dd-mmm-yy, but when i created a
> > macro to do the same thing, the problem iam facing here is when it open  each
> > csv files the date is getting changed(the column contains both text and date
> > values)
> > 
> > when i open the file using the below code it opens the file in a actual
> > format(date values will not change)
> > 
> > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > 
> > but when i open the file using the below code it opens in a different
> > format(date value changes)
> > 
> > arrWorkBook = Array("ABC.csv","DEF.csv")
> > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > arrWorkBook(intTemp)
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/18/2009 2:15:01 PM
Rename or copy a .csv file to .txt

Record a macro when you open the file.  You'll be prompted for the type of
data--fixed width or delimited.  Choose delimited and then by a comma.

The wizard will continue and you'll be able to specify how each field should be
treated.  And you'll be able to choose the correct mdy order for date fields,
too.



Ranjith Kurian wrote:
> 
> Hi Dave,
> 
> Thanks for your informations.
> 
> As you said in the below that its better to convert the .csv file to .txt
> file, the problem here is the txt file allways separate the columns based on
> Comma, so suppose if there are two columns like  Names and Amounts, and if
> any name contain comma, the name will be separated to next column where
> amount was suppose to be.
> 
> "Dave Peterson" wrote:
> 
> > I'm surprised that there was any difference in the way the data was treated.
> >
> > In my simple tests (using USA date settings (mdy order)), both worked the same
> > way.
> >
> > But (if I recall correctly), opening CSV files via code will use USA settings.
> >
> > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > or in code) and use .opentext to open the file(s).  Then I could specify each
> > field the way I wanted.
> >
> > I'd be very concerned about date fields coming in as date fields--but not
> > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > 2003 or Feb 1, 2003 or ...).
> >
> > I'd want to make sure all the ambiguous dates would be brought in correctly.
> >
> > Ranjith Kurian wrote:
> > >
> > > I have a lot of csv file, in that file the date column contain both text and
> > > date values, but when i change my system settings to UK and if i manually
> > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > macro to do the same thing, the problem iam facing here is when it open  each
> > > csv files the date is getting changed(the column contains both text and date
> > > values)
> > >
> > > when i open the file using the below code it opens the file in a actual
> > > format(date values will not change)
> > >
> > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > >
> > > but when i open the file using the below code it opens in a different
> > > format(date value changes)
> > >
> > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > arrWorkBook(intTemp)
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/18/2009 2:48:02 PM
Look at the filecopy statement in VBA's help.  One way (with no validity
checks):

Option Explicit
Sub testme02()
    
    Dim myOrigFilename As String
    Dim myNewFileName As String
    Dim TempWkbk As Workbook
    Dim Wkbk As Workbook
    
    myOrigFilename = "C:\my documents\excel\book1.csv"
    
    If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
       myNewFileName = myOrigFilename & ".txt" 'just append .txt
       FileCopy Source:=myOrigFilename, Destination:=myNewFileName
    Else
        myNewFileName = myOrigFilename 'just plop it in
    End If
    
    'your modified recorded code goes here
    Workbooks.OpenText Filename:=myNewFileName, _
        Origin:=437, StartRow:=1, DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, _
        ConsecutiveDelimiter:=False, _
        Tab:=False, Semicolon:=False, Comma:=True, _
        Space:=False, Other:=False, _
        FieldInfo:=Array(Array(1, 3), Array(2, 1), _
                        Array(3, 2), Array(4, 1)), _
        TrailingMinusNumbers:=True
        
    'opens the file in worksheet in a new workbook
    Set TempWkbk = ActiveWorkbook
    
    'copy the sheet to a different new workbook
    'so that the text file can be closed
    ActiveSheet.Copy 'to a new workbook
    Set Wkbk = ActiveWorkbook
    
    TempWkbk.Close savechanges:=False
    
    Wkbk.Activate
    
    If myOrigFilename <> myNewFileName Then
        'delete the temporary .txt file
        Kill myNewFileName
    End If
    
End Sub


Ranjith Kurian wrote:
> 
> Hi Dave,
> 
> Thanks for your informations.
> 
> As you said in the below that its better to convert the .csv file to .txt
> file, the problem here is the txt file allways separate the columns based on
> Comma, so suppose if there are two columns like  Names and Amounts, and if
> any name contain comma, the name will be separated to next column where
> amount was suppose to be.
> 
> "Dave Peterson" wrote:
> 
> > I'm surprised that there was any difference in the way the data was treated.
> >
> > In my simple tests (using USA date settings (mdy order)), both worked the same
> > way.
> >
> > But (if I recall correctly), opening CSV files via code will use USA settings.
> >
> > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > or in code) and use .opentext to open the file(s).  Then I could specify each
> > field the way I wanted.
> >
> > I'd be very concerned about date fields coming in as date fields--but not
> > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > 2003 or Feb 1, 2003 or ...).
> >
> > I'd want to make sure all the ambiguous dates would be brought in correctly.
> >
> > Ranjith Kurian wrote:
> > >
> > > I have a lot of csv file, in that file the date column contain both text and
> > > date values, but when i change my system settings to UK and if i manually
> > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > macro to do the same thing, the problem iam facing here is when it open  each
> > > csv files the date is getting changed(the column contains both text and date
> > > values)
> > >
> > > when i open the file using the below code it opens the file in a actual
> > > format(date values will not change)
> > >
> > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > >
> > > but when i open the file using the below code it opens in a different
> > > format(date value changes)
> > >
> > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > arrWorkBook(intTemp)
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/18/2009 3:00:52 PM
Hi Dave

I tried it but did not work.



"Dave Peterson" wrote:

> Look at the filecopy statement in VBA's help.  One way (with no validity
> checks):
> 
> Option Explicit
> Sub testme02()
>     
>     Dim myOrigFilename As String
>     Dim myNewFileName As String
>     Dim TempWkbk As Workbook
>     Dim Wkbk As Workbook
>     
>     myOrigFilename = "C:\my documents\excel\book1.csv"
>     
>     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
>        myNewFileName = myOrigFilename & ".txt" 'just append .txt
>        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
>     Else
>         myNewFileName = myOrigFilename 'just plop it in
>     End If
>     
>     'your modified recorded code goes here
>     Workbooks.OpenText Filename:=myNewFileName, _
>         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
>         TextQualifier:=xlDoubleQuote, _
>         ConsecutiveDelimiter:=False, _
>         Tab:=False, Semicolon:=False, Comma:=True, _
>         Space:=False, Other:=False, _
>         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
>                         Array(3, 2), Array(4, 1)), _
>         TrailingMinusNumbers:=True
>         
>     'opens the file in worksheet in a new workbook
>     Set TempWkbk = ActiveWorkbook
>     
>     'copy the sheet to a different new workbook
>     'so that the text file can be closed
>     ActiveSheet.Copy 'to a new workbook
>     Set Wkbk = ActiveWorkbook
>     
>     TempWkbk.Close savechanges:=False
>     
>     Wkbk.Activate
>     
>     If myOrigFilename <> myNewFileName Then
>         'delete the temporary .txt file
>         Kill myNewFileName
>     End If
>     
> End Sub
> 
> 
> Ranjith Kurian wrote:
> > 
> > Hi Dave,
> > 
> > Thanks for your informations.
> > 
> > As you said in the below that its better to convert the .csv file to .txt
> > file, the problem here is the txt file allways separate the columns based on
> > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > any name contain comma, the name will be separated to next column where
> > amount was suppose to be.
> > 
> > "Dave Peterson" wrote:
> > 
> > > I'm surprised that there was any difference in the way the data was treated.
> > >
> > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > way.
> > >
> > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > >
> > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > field the way I wanted.
> > >
> > > I'd be very concerned about date fields coming in as date fields--but not
> > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > 2003 or Feb 1, 2003 or ...).
> > >
> > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > >
> > > Ranjith Kurian wrote:
> > > >
> > > > I have a lot of csv file, in that file the date column contain both text and
> > > > date values, but when i change my system settings to UK and if i manually
> > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > csv files the date is getting changed(the column contains both text and date
> > > > values)
> > > >
> > > > when i open the file using the below code it opens the file in a actual
> > > > format(date values will not change)
> > > >
> > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > >
> > > > but when i open the file using the below code it opens in a different
> > > > format(date value changes)
> > > >
> > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > arrWorkBook(intTemp)
> > >
> > > --
> > >
> > > Dave Peterson
> > > .
> > >
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/18/2009 5:14:01 PM
It worked for me.

Maybe you should try it again or even explain what happened and how it failed
when you tried it.

Ranjith Kurian wrote:
> 
> Hi Dave
> 
> I tried it but did not work.
> 
> "Dave Peterson" wrote:
> 
> > Look at the filecopy statement in VBA's help.  One way (with no validity
> > checks):
> >
> > Option Explicit
> > Sub testme02()
> >
> >     Dim myOrigFilename As String
> >     Dim myNewFileName As String
> >     Dim TempWkbk As Workbook
> >     Dim Wkbk As Workbook
> >
> >     myOrigFilename = "C:\my documents\excel\book1.csv"
> >
> >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> >     Else
> >         myNewFileName = myOrigFilename 'just plop it in
> >     End If
> >
> >     'your modified recorded code goes here
> >     Workbooks.OpenText Filename:=myNewFileName, _
> >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> >         TextQualifier:=xlDoubleQuote, _
> >         ConsecutiveDelimiter:=False, _
> >         Tab:=False, Semicolon:=False, Comma:=True, _
> >         Space:=False, Other:=False, _
> >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> >                         Array(3, 2), Array(4, 1)), _
> >         TrailingMinusNumbers:=True
> >
> >     'opens the file in worksheet in a new workbook
> >     Set TempWkbk = ActiveWorkbook
> >
> >     'copy the sheet to a different new workbook
> >     'so that the text file can be closed
> >     ActiveSheet.Copy 'to a new workbook
> >     Set Wkbk = ActiveWorkbook
> >
> >     TempWkbk.Close savechanges:=False
> >
> >     Wkbk.Activate
> >
> >     If myOrigFilename <> myNewFileName Then
> >         'delete the temporary .txt file
> >         Kill myNewFileName
> >     End If
> >
> > End Sub
> >
> >
> > Ranjith Kurian wrote:
> > >
> > > Hi Dave,
> > >
> > > Thanks for your informations.
> > >
> > > As you said in the below that its better to convert the .csv file to .txt
> > > file, the problem here is the txt file allways separate the columns based on
> > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > any name contain comma, the name will be separated to next column where
> > > amount was suppose to be.
> > >
> > > "Dave Peterson" wrote:
> > >
> > > > I'm surprised that there was any difference in the way the data was treated.
> > > >
> > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > way.
> > > >
> > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > >
> > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > field the way I wanted.
> > > >
> > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > 2003 or Feb 1, 2003 or ...).
> > > >
> > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > >
> > > > Ranjith Kurian wrote:
> > > > >
> > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > date values, but when i change my system settings to UK and if i manually
> > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > csv files the date is getting changed(the column contains both text and date
> > > > > values)
> > > > >
> > > > > when i open the file using the below code it opens the file in a actual
> > > > > format(date values will not change)
> > > > >
> > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > >
> > > > > but when i open the file using the below code it opens in a different
> > > > > format(date value changes)
> > > > >
> > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > arrWorkBook(intTemp)
> > > >
> > > > --
> > > >
> > > > Dave Peterson
> > > > .
> > > >
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/18/2009 5:45:20 PM
Hi Dave,

My date column contains both text value and date values, but if i change my 
system setting to UK the date column will get changed to only date values, 
after this iam able to change the format manually in format 
cells-custom-dd-mmm-yy. but these are not happing through code, i tried your 
below code but the file still opens in a US format.

I tried even doing Text to column-Delimited, through below code, there two 
problem raised, one the date column contains both text value and date value,
and the second problem was the date did not convert to UK format.


"Dave Peterson" wrote:

> It worked for me.
> 
> Maybe you should try it again or even explain what happened and how it failed
> when you tried it.
> 
> Ranjith Kurian wrote:
> > 
> > Hi Dave
> > 
> > I tried it but did not work.
> > 
> > "Dave Peterson" wrote:
> > 
> > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > checks):
> > >
> > > Option Explicit
> > > Sub testme02()
> > >
> > >     Dim myOrigFilename As String
> > >     Dim myNewFileName As String
> > >     Dim TempWkbk As Workbook
> > >     Dim Wkbk As Workbook
> > >
> > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > >
> > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > >     Else
> > >         myNewFileName = myOrigFilename 'just plop it in
> > >     End If
> > >
> > >     'your modified recorded code goes here
> > >     Workbooks.OpenText Filename:=myNewFileName, _
> > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > >         TextQualifier:=xlDoubleQuote, _
> > >         ConsecutiveDelimiter:=False, _
> > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > >         Space:=False, Other:=False, _
> > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > >                         Array(3, 2), Array(4, 1)), _
> > >         TrailingMinusNumbers:=True
> > >
> > >     'opens the file in worksheet in a new workbook
> > >     Set TempWkbk = ActiveWorkbook
> > >
> > >     'copy the sheet to a different new workbook
> > >     'so that the text file can be closed
> > >     ActiveSheet.Copy 'to a new workbook
> > >     Set Wkbk = ActiveWorkbook
> > >
> > >     TempWkbk.Close savechanges:=False
> > >
> > >     Wkbk.Activate
> > >
> > >     If myOrigFilename <> myNewFileName Then
> > >         'delete the temporary .txt file
> > >         Kill myNewFileName
> > >     End If
> > >
> > > End Sub
> > >
> > >
> > > Ranjith Kurian wrote:
> > > >
> > > > Hi Dave,
> > > >
> > > > Thanks for your informations.
> > > >
> > > > As you said in the below that its better to convert the .csv file to .txt
> > > > file, the problem here is the txt file allways separate the columns based on
> > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > any name contain comma, the name will be separated to next column where
> > > > amount was suppose to be.
> > > >
> > > > "Dave Peterson" wrote:
> > > >
> > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > >
> > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > way.
> > > > >
> > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > >
> > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > field the way I wanted.
> > > > >
> > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > 2003 or Feb 1, 2003 or ...).
> > > > >
> > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > >
> > > > > Ranjith Kurian wrote:
> > > > > >
> > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > values)
> > > > > >
> > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > format(date values will not change)
> > > > > >
> > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > >
> > > > > > but when i open the file using the below code it opens in a different
> > > > > > format(date value changes)
> > > > > >
> > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > arrWorkBook(intTemp)
> > > > >
> > > > > --
> > > > >
> > > > > Dave Peterson
> > > > > .
> > > > >
> > >
> > > --
> > >
> > > Dave Peterson
> > > .
> > >
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/21/2009 10:24:01 AM
Do it manually after renaming the .csv to .txt--without adjusting your windows
date settings.

Do you get the results you want?



Ranjith Kurian wrote:
> 
> Hi Dave,
> 
> My date column contains both text value and date values, but if i change my
> system setting to UK the date column will get changed to only date values,
> after this iam able to change the format manually in format
> cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> below code but the file still opens in a US format.
> 
> I tried even doing Text to column-Delimited, through below code, there two
> problem raised, one the date column contains both text value and date value,
> and the second problem was the date did not convert to UK format.
> 
> "Dave Peterson" wrote:
> 
> > It worked for me.
> >
> > Maybe you should try it again or even explain what happened and how it failed
> > when you tried it.
> >
> > Ranjith Kurian wrote:
> > >
> > > Hi Dave
> > >
> > > I tried it but did not work.
> > >
> > > "Dave Peterson" wrote:
> > >
> > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > checks):
> > > >
> > > > Option Explicit
> > > > Sub testme02()
> > > >
> > > >     Dim myOrigFilename As String
> > > >     Dim myNewFileName As String
> > > >     Dim TempWkbk As Workbook
> > > >     Dim Wkbk As Workbook
> > > >
> > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > >
> > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > >     Else
> > > >         myNewFileName = myOrigFilename 'just plop it in
> > > >     End If
> > > >
> > > >     'your modified recorded code goes here
> > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > >         TextQualifier:=xlDoubleQuote, _
> > > >         ConsecutiveDelimiter:=False, _
> > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > >         Space:=False, Other:=False, _
> > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > >                         Array(3, 2), Array(4, 1)), _
> > > >         TrailingMinusNumbers:=True
> > > >
> > > >     'opens the file in worksheet in a new workbook
> > > >     Set TempWkbk = ActiveWorkbook
> > > >
> > > >     'copy the sheet to a different new workbook
> > > >     'so that the text file can be closed
> > > >     ActiveSheet.Copy 'to a new workbook
> > > >     Set Wkbk = ActiveWorkbook
> > > >
> > > >     TempWkbk.Close savechanges:=False
> > > >
> > > >     Wkbk.Activate
> > > >
> > > >     If myOrigFilename <> myNewFileName Then
> > > >         'delete the temporary .txt file
> > > >         Kill myNewFileName
> > > >     End If
> > > >
> > > > End Sub
> > > >
> > > >
> > > > Ranjith Kurian wrote:
> > > > >
> > > > > Hi Dave,
> > > > >
> > > > > Thanks for your informations.
> > > > >
> > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > any name contain comma, the name will be separated to next column where
> > > > > amount was suppose to be.
> > > > >
> > > > > "Dave Peterson" wrote:
> > > > >
> > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > >
> > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > way.
> > > > > >
> > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > >
> > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > field the way I wanted.
> > > > > >
> > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > >
> > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > >
> > > > > > Ranjith Kurian wrote:
> > > > > > >
> > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > values)
> > > > > > >
> > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > format(date values will not change)
> > > > > > >
> > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > >
> > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > format(date value changes)
> > > > > > >
> > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > arrWorkBook(intTemp)
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Dave Peterson
> > > > > > .
> > > > > >
> > > >
> > > > --
> > > >
> > > > Dave Peterson
> > > > .
> > > >
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/21/2009 1:23:04 PM
Hi Dave,
Thanks for the reply,
As you said i manually changed the csv file to txt and tried to open the 
file using the below code it did not allow me to open (macro did not work)
I hope this will work if we change it manually to txt file , if could you 
correct my below code.


Sub combine()
Dim intTemp As Integer, arrWorkBook As Variant

arrWorkBook = Array("OPN CH CS.txt", "OPN CH UBS.txt")
For intTemp = 0 To UBound(arrWorkBook)
Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week" & 
arrWorkBook(intTemp), Origin:=xlWindows, _
        StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
        ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, 
Comma:=True, _
        Space:=False, Other:=False, FieldInfo:=Array(Array(1, 4), Array(2, 
1), Array( _
        3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 
1), Array(9, 1), Array(10 _
        , 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)), 
TrailingMinusNumbers:= _
        True
        
Next
End Sub




"Dave Peterson" wrote:

> Do it manually after renaming the .csv to .txt--without adjusting your windows
> date settings.
> 
> Do you get the results you want?
> 
> 
> 
> Ranjith Kurian wrote:
> > 
> > Hi Dave,
> > 
> > My date column contains both text value and date values, but if i change my
> > system setting to UK the date column will get changed to only date values,
> > after this iam able to change the format manually in format
> > cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> > below code but the file still opens in a US format.
> > 
> > I tried even doing Text to column-Delimited, through below code, there two
> > problem raised, one the date column contains both text value and date value,
> > and the second problem was the date did not convert to UK format.
> > 
> > "Dave Peterson" wrote:
> > 
> > > It worked for me.
> > >
> > > Maybe you should try it again or even explain what happened and how it failed
> > > when you tried it.
> > >
> > > Ranjith Kurian wrote:
> > > >
> > > > Hi Dave
> > > >
> > > > I tried it but did not work.
> > > >
> > > > "Dave Peterson" wrote:
> > > >
> > > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > > checks):
> > > > >
> > > > > Option Explicit
> > > > > Sub testme02()
> > > > >
> > > > >     Dim myOrigFilename As String
> > > > >     Dim myNewFileName As String
> > > > >     Dim TempWkbk As Workbook
> > > > >     Dim Wkbk As Workbook
> > > > >
> > > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > > >
> > > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > > >     Else
> > > > >         myNewFileName = myOrigFilename 'just plop it in
> > > > >     End If
> > > > >
> > > > >     'your modified recorded code goes here
> > > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > > >         TextQualifier:=xlDoubleQuote, _
> > > > >         ConsecutiveDelimiter:=False, _
> > > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > > >         Space:=False, Other:=False, _
> > > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > > >                         Array(3, 2), Array(4, 1)), _
> > > > >         TrailingMinusNumbers:=True
> > > > >
> > > > >     'opens the file in worksheet in a new workbook
> > > > >     Set TempWkbk = ActiveWorkbook
> > > > >
> > > > >     'copy the sheet to a different new workbook
> > > > >     'so that the text file can be closed
> > > > >     ActiveSheet.Copy 'to a new workbook
> > > > >     Set Wkbk = ActiveWorkbook
> > > > >
> > > > >     TempWkbk.Close savechanges:=False
> > > > >
> > > > >     Wkbk.Activate
> > > > >
> > > > >     If myOrigFilename <> myNewFileName Then
> > > > >         'delete the temporary .txt file
> > > > >         Kill myNewFileName
> > > > >     End If
> > > > >
> > > > > End Sub
> > > > >
> > > > >
> > > > > Ranjith Kurian wrote:
> > > > > >
> > > > > > Hi Dave,
> > > > > >
> > > > > > Thanks for your informations.
> > > > > >
> > > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > > any name contain comma, the name will be separated to next column where
> > > > > > amount was suppose to be.
> > > > > >
> > > > > > "Dave Peterson" wrote:
> > > > > >
> > > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > > >
> > > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > > way.
> > > > > > >
> > > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > > >
> > > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > > field the way I wanted.
> > > > > > >
> > > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > > >
> > > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > > >
> > > > > > > Ranjith Kurian wrote:
> > > > > > > >
> > > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > > values)
> > > > > > > >
> > > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > > format(date values will not change)
> > > > > > > >
> > > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > > >
> > > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > > format(date value changes)
> > > > > > > >
> > > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > > arrWorkBook(intTemp)
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Dave Peterson
> > > > > > > .
> > > > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Dave Peterson
> > > > > .
> > > > >
> > >
> > > --
> > >
> > > Dave Peterson
> > > .
> > >
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/21/2009 3:21:02 PM
Just a guess...

If "C:\Ranjith Report\FGA DEBT\Raw\Week" is a path, then you need to end with a
backslash:

Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week\" _
  & arrWorkBook(intTemp), ...

If that doesn't help, what error do you see when it fails?

Ranjith Kurian wrote:
> 
> Hi Dave,
> Thanks for the reply,
> As you said i manually changed the csv file to txt and tried to open the
> file using the below code it did not allow me to open (macro did not work)
> I hope this will work if we change it manually to txt file , if could you
> correct my below code.
> 
> Sub combine()
> Dim intTemp As Integer, arrWorkBook As Variant
> 
> arrWorkBook = Array("OPN CH CS.txt", "OPN CH UBS.txt")
> For intTemp = 0 To UBound(arrWorkBook)
> Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week" &
> arrWorkBook(intTemp), Origin:=xlWindows, _
>         StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
>         ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
> Comma:=True, _
>         Space:=False, Other:=False, FieldInfo:=Array(Array(1, 4), Array(2,
> 1), Array( _
>         3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8,
> 1), Array(9, 1), Array(10 _
>         , 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)),
> TrailingMinusNumbers:= _
>         True
> 
> Next
> End Sub
> 
> "Dave Peterson" wrote:
> 
> > Do it manually after renaming the .csv to .txt--without adjusting your windows
> > date settings.
> >
> > Do you get the results you want?
> >
> >
> >
> > Ranjith Kurian wrote:
> > >
> > > Hi Dave,
> > >
> > > My date column contains both text value and date values, but if i change my
> > > system setting to UK the date column will get changed to only date values,
> > > after this iam able to change the format manually in format
> > > cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> > > below code but the file still opens in a US format.
> > >
> > > I tried even doing Text to column-Delimited, through below code, there two
> > > problem raised, one the date column contains both text value and date value,
> > > and the second problem was the date did not convert to UK format.
> > >
> > > "Dave Peterson" wrote:
> > >
> > > > It worked for me.
> > > >
> > > > Maybe you should try it again or even explain what happened and how it failed
> > > > when you tried it.
> > > >
> > > > Ranjith Kurian wrote:
> > > > >
> > > > > Hi Dave
> > > > >
> > > > > I tried it but did not work.
> > > > >
> > > > > "Dave Peterson" wrote:
> > > > >
> > > > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > > > checks):
> > > > > >
> > > > > > Option Explicit
> > > > > > Sub testme02()
> > > > > >
> > > > > >     Dim myOrigFilename As String
> > > > > >     Dim myNewFileName As String
> > > > > >     Dim TempWkbk As Workbook
> > > > > >     Dim Wkbk As Workbook
> > > > > >
> > > > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > > > >
> > > > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > > > >     Else
> > > > > >         myNewFileName = myOrigFilename 'just plop it in
> > > > > >     End If
> > > > > >
> > > > > >     'your modified recorded code goes here
> > > > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > > > >         TextQualifier:=xlDoubleQuote, _
> > > > > >         ConsecutiveDelimiter:=False, _
> > > > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > > > >         Space:=False, Other:=False, _
> > > > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > > > >                         Array(3, 2), Array(4, 1)), _
> > > > > >         TrailingMinusNumbers:=True
> > > > > >
> > > > > >     'opens the file in worksheet in a new workbook
> > > > > >     Set TempWkbk = ActiveWorkbook
> > > > > >
> > > > > >     'copy the sheet to a different new workbook
> > > > > >     'so that the text file can be closed
> > > > > >     ActiveSheet.Copy 'to a new workbook
> > > > > >     Set Wkbk = ActiveWorkbook
> > > > > >
> > > > > >     TempWkbk.Close savechanges:=False
> > > > > >
> > > > > >     Wkbk.Activate
> > > > > >
> > > > > >     If myOrigFilename <> myNewFileName Then
> > > > > >         'delete the temporary .txt file
> > > > > >         Kill myNewFileName
> > > > > >     End If
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > >
> > > > > > Ranjith Kurian wrote:
> > > > > > >
> > > > > > > Hi Dave,
> > > > > > >
> > > > > > > Thanks for your informations.
> > > > > > >
> > > > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > > > any name contain comma, the name will be separated to next column where
> > > > > > > amount was suppose to be.
> > > > > > >
> > > > > > > "Dave Peterson" wrote:
> > > > > > >
> > > > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > > > >
> > > > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > > > way.
> > > > > > > >
> > > > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > > > >
> > > > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > > > field the way I wanted.
> > > > > > > >
> > > > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > > > >
> > > > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > > > >
> > > > > > > > Ranjith Kurian wrote:
> > > > > > > > >
> > > > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > > > values)
> > > > > > > > >
> > > > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > > > format(date values will not change)
> > > > > > > > >
> > > > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > > > >
> > > > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > > > format(date value changes)
> > > > > > > > >
> > > > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > > > arrWorkBook(intTemp)
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > Dave Peterson
> > > > > > > > .
> > > > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Dave Peterson
> > > > > > .
> > > > > >
> > > >
> > > > --
> > > >
> > > > Dave Peterson
> > > > .
> > > >
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/21/2009 3:35:49 PM
Hi Dave,

Thanks,

The code works fine, but when the file is opened the date column contain 
both text value and Date value. Date value is in UK format but what to do for 
text value.


"Dave Peterson" wrote:

> Just a guess...
> 
> If "C:\Ranjith Report\FGA DEBT\Raw\Week" is a path, then you need to end with a
> backslash:
> 
> Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week\" _
>   & arrWorkBook(intTemp), ...
> 
> If that doesn't help, what error do you see when it fails?
> 
> Ranjith Kurian wrote:
> > 
> > Hi Dave,
> > Thanks for the reply,
> > As you said i manually changed the csv file to txt and tried to open the
> > file using the below code it did not allow me to open (macro did not work)
> > I hope this will work if we change it manually to txt file , if could you
> > correct my below code.
> > 
> > Sub combine()
> > Dim intTemp As Integer, arrWorkBook As Variant
> > 
> > arrWorkBook = Array("OPN CH CS.txt", "OPN CH UBS.txt")
> > For intTemp = 0 To UBound(arrWorkBook)
> > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week" &
> > arrWorkBook(intTemp), Origin:=xlWindows, _
> >         StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
> >         ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
> > Comma:=True, _
> >         Space:=False, Other:=False, FieldInfo:=Array(Array(1, 4), Array(2,
> > 1), Array( _
> >         3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8,
> > 1), Array(9, 1), Array(10 _
> >         , 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)),
> > TrailingMinusNumbers:= _
> >         True
> > 
> > Next
> > End Sub
> > 
> > "Dave Peterson" wrote:
> > 
> > > Do it manually after renaming the .csv to .txt--without adjusting your windows
> > > date settings.
> > >
> > > Do you get the results you want?
> > >
> > >
> > >
> > > Ranjith Kurian wrote:
> > > >
> > > > Hi Dave,
> > > >
> > > > My date column contains both text value and date values, but if i change my
> > > > system setting to UK the date column will get changed to only date values,
> > > > after this iam able to change the format manually in format
> > > > cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> > > > below code but the file still opens in a US format.
> > > >
> > > > I tried even doing Text to column-Delimited, through below code, there two
> > > > problem raised, one the date column contains both text value and date value,
> > > > and the second problem was the date did not convert to UK format.
> > > >
> > > > "Dave Peterson" wrote:
> > > >
> > > > > It worked for me.
> > > > >
> > > > > Maybe you should try it again or even explain what happened and how it failed
> > > > > when you tried it.
> > > > >
> > > > > Ranjith Kurian wrote:
> > > > > >
> > > > > > Hi Dave
> > > > > >
> > > > > > I tried it but did not work.
> > > > > >
> > > > > > "Dave Peterson" wrote:
> > > > > >
> > > > > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > > > > checks):
> > > > > > >
> > > > > > > Option Explicit
> > > > > > > Sub testme02()
> > > > > > >
> > > > > > >     Dim myOrigFilename As String
> > > > > > >     Dim myNewFileName As String
> > > > > > >     Dim TempWkbk As Workbook
> > > > > > >     Dim Wkbk As Workbook
> > > > > > >
> > > > > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > > > > >
> > > > > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > > > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > > > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > > > > >     Else
> > > > > > >         myNewFileName = myOrigFilename 'just plop it in
> > > > > > >     End If
> > > > > > >
> > > > > > >     'your modified recorded code goes here
> > > > > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > > > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > > > > >         TextQualifier:=xlDoubleQuote, _
> > > > > > >         ConsecutiveDelimiter:=False, _
> > > > > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > > > > >         Space:=False, Other:=False, _
> > > > > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > > > > >                         Array(3, 2), Array(4, 1)), _
> > > > > > >         TrailingMinusNumbers:=True
> > > > > > >
> > > > > > >     'opens the file in worksheet in a new workbook
> > > > > > >     Set TempWkbk = ActiveWorkbook
> > > > > > >
> > > > > > >     'copy the sheet to a different new workbook
> > > > > > >     'so that the text file can be closed
> > > > > > >     ActiveSheet.Copy 'to a new workbook
> > > > > > >     Set Wkbk = ActiveWorkbook
> > > > > > >
> > > > > > >     TempWkbk.Close savechanges:=False
> > > > > > >
> > > > > > >     Wkbk.Activate
> > > > > > >
> > > > > > >     If myOrigFilename <> myNewFileName Then
> > > > > > >         'delete the temporary .txt file
> > > > > > >         Kill myNewFileName
> > > > > > >     End If
> > > > > > >
> > > > > > > End Sub
> > > > > > >
> > > > > > >
> > > > > > > Ranjith Kurian wrote:
> > > > > > > >
> > > > > > > > Hi Dave,
> > > > > > > >
> > > > > > > > Thanks for your informations.
> > > > > > > >
> > > > > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > > > > any name contain comma, the name will be separated to next column where
> > > > > > > > amount was suppose to be.
> > > > > > > >
> > > > > > > > "Dave Peterson" wrote:
> > > > > > > >
> > > > > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > > > > >
> > > > > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > > > > way.
> > > > > > > > >
> > > > > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > > > > >
> > > > > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > > > > field the way I wanted.
> > > > > > > > >
> > > > > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > > > > >
> > > > > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > > > > >
> > > > > > > > > Ranjith Kurian wrote:
> > > > > > > > > >
> > > > > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > > > > values)
> > > > > > > > > >
> > > > > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > > > > format(date values will not change)
> > > > > > > > > >
> > > > > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > > > > >
> > > > > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > > > > format(date value changes)
> > > > > > > > > >
> > > > > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > > > > arrWorkBook(intTemp)
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > Dave Peterson
> > > > > > > > > .
> > > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Dave Peterson
> > > > > > > .
> > > > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Dave Peterson
> > > > > .
> > > > >
> > >
> > > --
> > >
> > > Dave Peterson
> > > .
> > >
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/21/2009 5:18:01 PM
In my testing, the text values were untouched.  They remained plain old text.

What happened when you did it?

Ranjith Kurian wrote:
> 
> Hi Dave,
> 
> Thanks,
> 
> The code works fine, but when the file is opened the date column contain
> both text value and Date value. Date value is in UK format but what to do for
> text value.
> 
> "Dave Peterson" wrote:
> 
> > Just a guess...
> >
> > If "C:\Ranjith Report\FGA DEBT\Raw\Week" is a path, then you need to end with a
> > backslash:
> >
> > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week\" _
> >   & arrWorkBook(intTemp), ...
> >
> > If that doesn't help, what error do you see when it fails?
> >
> > Ranjith Kurian wrote:
> > >
> > > Hi Dave,
> > > Thanks for the reply,
> > > As you said i manually changed the csv file to txt and tried to open the
> > > file using the below code it did not allow me to open (macro did not work)
> > > I hope this will work if we change it manually to txt file , if could you
> > > correct my below code.
> > >
> > > Sub combine()
> > > Dim intTemp As Integer, arrWorkBook As Variant
> > >
> > > arrWorkBook = Array("OPN CH CS.txt", "OPN CH UBS.txt")
> > > For intTemp = 0 To UBound(arrWorkBook)
> > > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week" &
> > > arrWorkBook(intTemp), Origin:=xlWindows, _
> > >         StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
> > >         ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
> > > Comma:=True, _
> > >         Space:=False, Other:=False, FieldInfo:=Array(Array(1, 4), Array(2,
> > > 1), Array( _
> > >         3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8,
> > > 1), Array(9, 1), Array(10 _
> > >         , 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)),
> > > TrailingMinusNumbers:= _
> > >         True
> > >
> > > Next
> > > End Sub
> > >
> > > "Dave Peterson" wrote:
> > >
> > > > Do it manually after renaming the .csv to .txt--without adjusting your windows
> > > > date settings.
> > > >
> > > > Do you get the results you want?
> > > >
> > > >
> > > >
> > > > Ranjith Kurian wrote:
> > > > >
> > > > > Hi Dave,
> > > > >
> > > > > My date column contains both text value and date values, but if i change my
> > > > > system setting to UK the date column will get changed to only date values,
> > > > > after this iam able to change the format manually in format
> > > > > cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> > > > > below code but the file still opens in a US format.
> > > > >
> > > > > I tried even doing Text to column-Delimited, through below code, there two
> > > > > problem raised, one the date column contains both text value and date value,
> > > > > and the second problem was the date did not convert to UK format.
> > > > >
> > > > > "Dave Peterson" wrote:
> > > > >
> > > > > > It worked for me.
> > > > > >
> > > > > > Maybe you should try it again or even explain what happened and how it failed
> > > > > > when you tried it.
> > > > > >
> > > > > > Ranjith Kurian wrote:
> > > > > > >
> > > > > > > Hi Dave
> > > > > > >
> > > > > > > I tried it but did not work.
> > > > > > >
> > > > > > > "Dave Peterson" wrote:
> > > > > > >
> > > > > > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > > > > > checks):
> > > > > > > >
> > > > > > > > Option Explicit
> > > > > > > > Sub testme02()
> > > > > > > >
> > > > > > > >     Dim myOrigFilename As String
> > > > > > > >     Dim myNewFileName As String
> > > > > > > >     Dim TempWkbk As Workbook
> > > > > > > >     Dim Wkbk As Workbook
> > > > > > > >
> > > > > > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > > > > > >
> > > > > > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > > > > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > > > > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > > > > > >     Else
> > > > > > > >         myNewFileName = myOrigFilename 'just plop it in
> > > > > > > >     End If
> > > > > > > >
> > > > > > > >     'your modified recorded code goes here
> > > > > > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > > > > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > > > > > >         TextQualifier:=xlDoubleQuote, _
> > > > > > > >         ConsecutiveDelimiter:=False, _
> > > > > > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > > > > > >         Space:=False, Other:=False, _
> > > > > > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > > > > > >                         Array(3, 2), Array(4, 1)), _
> > > > > > > >         TrailingMinusNumbers:=True
> > > > > > > >
> > > > > > > >     'opens the file in worksheet in a new workbook
> > > > > > > >     Set TempWkbk = ActiveWorkbook
> > > > > > > >
> > > > > > > >     'copy the sheet to a different new workbook
> > > > > > > >     'so that the text file can be closed
> > > > > > > >     ActiveSheet.Copy 'to a new workbook
> > > > > > > >     Set Wkbk = ActiveWorkbook
> > > > > > > >
> > > > > > > >     TempWkbk.Close savechanges:=False
> > > > > > > >
> > > > > > > >     Wkbk.Activate
> > > > > > > >
> > > > > > > >     If myOrigFilename <> myNewFileName Then
> > > > > > > >         'delete the temporary .txt file
> > > > > > > >         Kill myNewFileName
> > > > > > > >     End If
> > > > > > > >
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > >
> > > > > > > > Ranjith Kurian wrote:
> > > > > > > > >
> > > > > > > > > Hi Dave,
> > > > > > > > >
> > > > > > > > > Thanks for your informations.
> > > > > > > > >
> > > > > > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > > > > > any name contain comma, the name will be separated to next column where
> > > > > > > > > amount was suppose to be.
> > > > > > > > >
> > > > > > > > > "Dave Peterson" wrote:
> > > > > > > > >
> > > > > > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > > > > > >
> > > > > > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > > > > > way.
> > > > > > > > > >
> > > > > > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > > > > > >
> > > > > > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > > > > > field the way I wanted.
> > > > > > > > > >
> > > > > > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > > > > > >
> > > > > > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > > > > > >
> > > > > > > > > > Ranjith Kurian wrote:
> > > > > > > > > > >
> > > > > > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > > > > > values)
> > > > > > > > > > >
> > > > > > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > > > > > format(date values will not change)
> > > > > > > > > > >
> > > > > > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > > > > > >
> > > > > > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > > > > > format(date value changes)
> > > > > > > > > > >
> > > > > > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > > > > > arrWorkBook(intTemp)
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > > > > > > Dave Peterson
> > > > > > > > > > .
> > > > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > Dave Peterson
> > > > > > > > .
> > > > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Dave Peterson
> > > > > > .
> > > > > >
> > > >
> > > > --
> > > >
> > > > Dave Peterson
> > > > .
> > > >
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/21/2009 5:31:00 PM
Hi Dave,

For me the text vlaues got changed.

"Dave Peterson" wrote:

> In my testing, the text values were untouched.  They remained plain old text.
> 
> What happened when you did it?
> 
> Ranjith Kurian wrote:
> > 
> > Hi Dave,
> > 
> > Thanks,
> > 
> > The code works fine, but when the file is opened the date column contain
> > both text value and Date value. Date value is in UK format but what to do for
> > text value.
> > 
> > "Dave Peterson" wrote:
> > 
> > > Just a guess...
> > >
> > > If "C:\Ranjith Report\FGA DEBT\Raw\Week" is a path, then you need to end with a
> > > backslash:
> > >
> > > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week\" _
> > >   & arrWorkBook(intTemp), ...
> > >
> > > If that doesn't help, what error do you see when it fails?
> > >
> > > Ranjith Kurian wrote:
> > > >
> > > > Hi Dave,
> > > > Thanks for the reply,
> > > > As you said i manually changed the csv file to txt and tried to open the
> > > > file using the below code it did not allow me to open (macro did not work)
> > > > I hope this will work if we change it manually to txt file , if could you
> > > > correct my below code.
> > > >
> > > > Sub combine()
> > > > Dim intTemp As Integer, arrWorkBook As Variant
> > > >
> > > > arrWorkBook = Array("OPN CH CS.txt", "OPN CH UBS.txt")
> > > > For intTemp = 0 To UBound(arrWorkBook)
> > > > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week" &
> > > > arrWorkBook(intTemp), Origin:=xlWindows, _
> > > >         StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
> > > >         ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
> > > > Comma:=True, _
> > > >         Space:=False, Other:=False, FieldInfo:=Array(Array(1, 4), Array(2,
> > > > 1), Array( _
> > > >         3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8,
> > > > 1), Array(9, 1), Array(10 _
> > > >         , 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)),
> > > > TrailingMinusNumbers:= _
> > > >         True
> > > >
> > > > Next
> > > > End Sub
> > > >
> > > > "Dave Peterson" wrote:
> > > >
> > > > > Do it manually after renaming the .csv to .txt--without adjusting your windows
> > > > > date settings.
> > > > >
> > > > > Do you get the results you want?
> > > > >
> > > > >
> > > > >
> > > > > Ranjith Kurian wrote:
> > > > > >
> > > > > > Hi Dave,
> > > > > >
> > > > > > My date column contains both text value and date values, but if i change my
> > > > > > system setting to UK the date column will get changed to only date values,
> > > > > > after this iam able to change the format manually in format
> > > > > > cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> > > > > > below code but the file still opens in a US format.
> > > > > >
> > > > > > I tried even doing Text to column-Delimited, through below code, there two
> > > > > > problem raised, one the date column contains both text value and date value,
> > > > > > and the second problem was the date did not convert to UK format.
> > > > > >
> > > > > > "Dave Peterson" wrote:
> > > > > >
> > > > > > > It worked for me.
> > > > > > >
> > > > > > > Maybe you should try it again or even explain what happened and how it failed
> > > > > > > when you tried it.
> > > > > > >
> > > > > > > Ranjith Kurian wrote:
> > > > > > > >
> > > > > > > > Hi Dave
> > > > > > > >
> > > > > > > > I tried it but did not work.
> > > > > > > >
> > > > > > > > "Dave Peterson" wrote:
> > > > > > > >
> > > > > > > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > > > > > > checks):
> > > > > > > > >
> > > > > > > > > Option Explicit
> > > > > > > > > Sub testme02()
> > > > > > > > >
> > > > > > > > >     Dim myOrigFilename As String
> > > > > > > > >     Dim myNewFileName As String
> > > > > > > > >     Dim TempWkbk As Workbook
> > > > > > > > >     Dim Wkbk As Workbook
> > > > > > > > >
> > > > > > > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > > > > > > >
> > > > > > > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > > > > > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > > > > > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > > > > > > >     Else
> > > > > > > > >         myNewFileName = myOrigFilename 'just plop it in
> > > > > > > > >     End If
> > > > > > > > >
> > > > > > > > >     'your modified recorded code goes here
> > > > > > > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > > > > > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > > > > > > >         TextQualifier:=xlDoubleQuote, _
> > > > > > > > >         ConsecutiveDelimiter:=False, _
> > > > > > > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > > > > > > >         Space:=False, Other:=False, _
> > > > > > > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > > > > > > >                         Array(3, 2), Array(4, 1)), _
> > > > > > > > >         TrailingMinusNumbers:=True
> > > > > > > > >
> > > > > > > > >     'opens the file in worksheet in a new workbook
> > > > > > > > >     Set TempWkbk = ActiveWorkbook
> > > > > > > > >
> > > > > > > > >     'copy the sheet to a different new workbook
> > > > > > > > >     'so that the text file can be closed
> > > > > > > > >     ActiveSheet.Copy 'to a new workbook
> > > > > > > > >     Set Wkbk = ActiveWorkbook
> > > > > > > > >
> > > > > > > > >     TempWkbk.Close savechanges:=False
> > > > > > > > >
> > > > > > > > >     Wkbk.Activate
> > > > > > > > >
> > > > > > > > >     If myOrigFilename <> myNewFileName Then
> > > > > > > > >         'delete the temporary .txt file
> > > > > > > > >         Kill myNewFileName
> > > > > > > > >     End If
> > > > > > > > >
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Ranjith Kurian wrote:
> > > > > > > > > >
> > > > > > > > > > Hi Dave,
> > > > > > > > > >
> > > > > > > > > > Thanks for your informations.
> > > > > > > > > >
> > > > > > > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > > > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > > > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > > > > > > any name contain comma, the name will be separated to next column where
> > > > > > > > > > amount was suppose to be.
> > > > > > > > > >
> > > > > > > > > > "Dave Peterson" wrote:
> > > > > > > > > >
> > > > > > > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > > > > > > >
> > > > > > > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > > > > > > way.
> > > > > > > > > > >
> > > > > > > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > > > > > > >
> > > > > > > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > > > > > > field the way I wanted.
> > > > > > > > > > >
> > > > > > > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > > > > > > >
> > > > > > > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > > > > > > >
> > > > > > > > > > > Ranjith Kurian wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > > > > > > values)
> > > > > > > > > > > >
> > > > > > > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > > > > > > format(date values will not change)
> > > > > > > > > > > >
> > > > > > > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > > > > > > >
> > > > > > > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > > > > > > format(date value changes)
> > > > > > > > > > > >
> > > > > > > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > > > > > > arrWorkBook(intTemp)
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > > > > > > > Dave Peterson
> > > > > > > > > > > .
> > > > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > Dave Peterson
> > > > > > > > > .
> > > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Dave Peterson
> > > > > > > .
> > > > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Dave Peterson
> > > > > .
> > > > >
> > >
> > > --
> > >
> > > Dave Peterson
> > > .
> > >
> 
> -- 
> 
> Dave Peterson
> .
> 
0
Utf
12/22/2009 5:27:01 PM
What were the text values and what did they get changed to?

Really, I don't have another suggestion.



Ranjith Kurian wrote:
> 
> Hi Dave,
> 
> For me the text vlaues got changed.
> 
> "Dave Peterson" wrote:
> 
> > In my testing, the text values were untouched.  They remained plain old text.
> >
> > What happened when you did it?
> >
> > Ranjith Kurian wrote:
> > >
> > > Hi Dave,
> > >
> > > Thanks,
> > >
> > > The code works fine, but when the file is opened the date column contain
> > > both text value and Date value. Date value is in UK format but what to do for
> > > text value.
> > >
> > > "Dave Peterson" wrote:
> > >
> > > > Just a guess...
> > > >
> > > > If "C:\Ranjith Report\FGA DEBT\Raw\Week" is a path, then you need to end with a
> > > > backslash:
> > > >
> > > > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week\" _
> > > >   & arrWorkBook(intTemp), ...
> > > >
> > > > If that doesn't help, what error do you see when it fails?
> > > >
> > > > Ranjith Kurian wrote:
> > > > >
> > > > > Hi Dave,
> > > > > Thanks for the reply,
> > > > > As you said i manually changed the csv file to txt and tried to open the
> > > > > file using the below code it did not allow me to open (macro did not work)
> > > > > I hope this will work if we change it manually to txt file , if could you
> > > > > correct my below code.
> > > > >
> > > > > Sub combine()
> > > > > Dim intTemp As Integer, arrWorkBook As Variant
> > > > >
> > > > > arrWorkBook = Array("OPN CH CS.txt", "OPN CH UBS.txt")
> > > > > For intTemp = 0 To UBound(arrWorkBook)
> > > > > Workbooks.OpenText Filename:="C:\Ranjith Report\FGA DEBT\Raw\Week" &
> > > > > arrWorkBook(intTemp), Origin:=xlWindows, _
> > > > >         StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
> > > > >         ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
> > > > > Comma:=True, _
> > > > >         Space:=False, Other:=False, FieldInfo:=Array(Array(1, 4), Array(2,
> > > > > 1), Array( _
> > > > >         3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8,
> > > > > 1), Array(9, 1), Array(10 _
> > > > >         , 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1)),
> > > > > TrailingMinusNumbers:= _
> > > > >         True
> > > > >
> > > > > Next
> > > > > End Sub
> > > > >
> > > > > "Dave Peterson" wrote:
> > > > >
> > > > > > Do it manually after renaming the .csv to .txt--without adjusting your windows
> > > > > > date settings.
> > > > > >
> > > > > > Do you get the results you want?
> > > > > >
> > > > > >
> > > > > >
> > > > > > Ranjith Kurian wrote:
> > > > > > >
> > > > > > > Hi Dave,
> > > > > > >
> > > > > > > My date column contains both text value and date values, but if i change my
> > > > > > > system setting to UK the date column will get changed to only date values,
> > > > > > > after this iam able to change the format manually in format
> > > > > > > cells-custom-dd-mmm-yy. but these are not happing through code, i tried your
> > > > > > > below code but the file still opens in a US format.
> > > > > > >
> > > > > > > I tried even doing Text to column-Delimited, through below code, there two
> > > > > > > problem raised, one the date column contains both text value and date value,
> > > > > > > and the second problem was the date did not convert to UK format.
> > > > > > >
> > > > > > > "Dave Peterson" wrote:
> > > > > > >
> > > > > > > > It worked for me.
> > > > > > > >
> > > > > > > > Maybe you should try it again or even explain what happened and how it failed
> > > > > > > > when you tried it.
> > > > > > > >
> > > > > > > > Ranjith Kurian wrote:
> > > > > > > > >
> > > > > > > > > Hi Dave
> > > > > > > > >
> > > > > > > > > I tried it but did not work.
> > > > > > > > >
> > > > > > > > > "Dave Peterson" wrote:
> > > > > > > > >
> > > > > > > > > > Look at the filecopy statement in VBA's help.  One way (with no validity
> > > > > > > > > > checks):
> > > > > > > > > >
> > > > > > > > > > Option Explicit
> > > > > > > > > > Sub testme02()
> > > > > > > > > >
> > > > > > > > > >     Dim myOrigFilename As String
> > > > > > > > > >     Dim myNewFileName As String
> > > > > > > > > >     Dim TempWkbk As Workbook
> > > > > > > > > >     Dim Wkbk As Workbook
> > > > > > > > > >
> > > > > > > > > >     myOrigFilename = "C:\my documents\excel\book1.csv"
> > > > > > > > > >
> > > > > > > > > >     If LCase(Right(myOrigFilename, 4)) = LCase(".csv") Then
> > > > > > > > > >        myNewFileName = myOrigFilename & ".txt" 'just append .txt
> > > > > > > > > >        FileCopy Source:=myOrigFilename, Destination:=myNewFileName
> > > > > > > > > >     Else
> > > > > > > > > >         myNewFileName = myOrigFilename 'just plop it in
> > > > > > > > > >     End If
> > > > > > > > > >
> > > > > > > > > >     'your modified recorded code goes here
> > > > > > > > > >     Workbooks.OpenText Filename:=myNewFileName, _
> > > > > > > > > >         Origin:=437, StartRow:=1, DataType:=xlDelimited, _
> > > > > > > > > >         TextQualifier:=xlDoubleQuote, _
> > > > > > > > > >         ConsecutiveDelimiter:=False, _
> > > > > > > > > >         Tab:=False, Semicolon:=False, Comma:=True, _
> > > > > > > > > >         Space:=False, Other:=False, _
> > > > > > > > > >         FieldInfo:=Array(Array(1, 3), Array(2, 1), _
> > > > > > > > > >                         Array(3, 2), Array(4, 1)), _
> > > > > > > > > >         TrailingMinusNumbers:=True
> > > > > > > > > >
> > > > > > > > > >     'opens the file in worksheet in a new workbook
> > > > > > > > > >     Set TempWkbk = ActiveWorkbook
> > > > > > > > > >
> > > > > > > > > >     'copy the sheet to a different new workbook
> > > > > > > > > >     'so that the text file can be closed
> > > > > > > > > >     ActiveSheet.Copy 'to a new workbook
> > > > > > > > > >     Set Wkbk = ActiveWorkbook
> > > > > > > > > >
> > > > > > > > > >     TempWkbk.Close savechanges:=False
> > > > > > > > > >
> > > > > > > > > >     Wkbk.Activate
> > > > > > > > > >
> > > > > > > > > >     If myOrigFilename <> myNewFileName Then
> > > > > > > > > >         'delete the temporary .txt file
> > > > > > > > > >         Kill myNewFileName
> > > > > > > > > >     End If
> > > > > > > > > >
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Ranjith Kurian wrote:
> > > > > > > > > > >
> > > > > > > > > > > Hi Dave,
> > > > > > > > > > >
> > > > > > > > > > > Thanks for your informations.
> > > > > > > > > > >
> > > > > > > > > > > As you said in the below that its better to convert the .csv file to .txt
> > > > > > > > > > > file, the problem here is the txt file allways separate the columns based on
> > > > > > > > > > > Comma, so suppose if there are two columns like  Names and Amounts, and if
> > > > > > > > > > > any name contain comma, the name will be separated to next column where
> > > > > > > > > > > amount was suppose to be.
> > > > > > > > > > >
> > > > > > > > > > > "Dave Peterson" wrote:
> > > > > > > > > > >
> > > > > > > > > > > > I'm surprised that there was any difference in the way the data was treated.
> > > > > > > > > > > >
> > > > > > > > > > > > In my simple tests (using USA date settings (mdy order)), both worked the same
> > > > > > > > > > > > way.
> > > > > > > > > > > >
> > > > > > > > > > > > But (if I recall correctly), opening CSV files via code will use USA settings.
> > > > > > > > > > > >
> > > > > > > > > > > > I wouldn't do it.  Instead I'd rename (or copy) the .csv files to .txt (manually
> > > > > > > > > > > > or in code) and use .opentext to open the file(s).  Then I could specify each
> > > > > > > > > > > > field the way I wanted.
> > > > > > > > > > > >
> > > > > > > > > > > > I'd be very concerned about date fields coming in as date fields--but not
> > > > > > > > > > > > representing the date in the actual source (01/02/03 could come in as Jan 2,
> > > > > > > > > > > > 2003 or Feb 1, 2003 or ...).
> > > > > > > > > > > >
> > > > > > > > > > > > I'd want to make sure all the ambiguous dates would be brought in correctly.
> > > > > > > > > > > >
> > > > > > > > > > > > Ranjith Kurian wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > I have a lot of csv file, in that file the date column contain both text and
> > > > > > > > > > > > > date values, but when i change my system settings to UK and if i manually
> > > > > > > > > > > > > change the date format using custom type "dd-mmm-yy", all the date and text
> > > > > > > > > > > > > value of that column will easily change to dd-mmm-yy, but when i created a
> > > > > > > > > > > > > macro to do the same thing, the problem iam facing here is when it open  each
> > > > > > > > > > > > > csv files the date is getting changed(the column contains both text and date
> > > > > > > > > > > > > values)
> > > > > > > > > > > > >
> > > > > > > > > > > > > when i open the file using the below code it opens the file in a actual
> > > > > > > > > > > > > format(date values will not change)
> > > > > > > > > > > > >
> > > > > > > > > > > > > ChDir "C:\Ranjith Report\FGA DEBT\Raw"
> > > > > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\ABC.csv"
> > > > > > > > > > > > >
> > > > > > > > > > > > > but when i open the file using the below code it opens in a different
> > > > > > > > > > > > > format(date value changes)
> > > > > > > > > > > > >
> > > > > > > > > > > > > arrWorkBook = Array("ABC.csv","DEF.csv")
> > > > > > > > > > > > > Workbooks.Open Filename:="C:\Ranjith Report\FGA DEBT\Raw\" &
> > > > > > > > > > > > > arrWorkBook(intTemp)
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > > > > > > > Dave Peterson
> > > > > > > > > > > > .
> > > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > > > > > > Dave Peterson
> > > > > > > > > > .
> > > > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > Dave Peterson
> > > > > > > > .
> > > > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Dave Peterson
> > > > > > .
> > > > > >
> > > >
> > > > --
> > > >
> > > > Dave Peterson
> > > > .
> > > >
> >
> > --
> >
> > Dave Peterson
> > .
> >

-- 

Dave Peterson
0
Dave
12/22/2009 5:38:14 PM
Reply:

Similar Artilces:

when i open an attachment it just shows a box i cannot open
Attachment, whether docs or pictures won't open. I can preview them inside the window pane, but then have to copy to word doc to print. Should be able to open attachment and then print just from there. Please help. It's like the Microsoft Picture manager is working strangely. ...

Opening a paramater form when open a report
I have a repor that takes date parameters from a seperate form.. As it is now I have to open the form put in the paramaters and then run the report which is based on a query... I would like to have the form pop up when I open the report and then close once once the report has run.. Help Please And thanks in advance bob On Wed, 15 Aug 2007 11:56:00 -0700, Bob wrote: > I have a repor that takes date parameters from a seperate form.. As it is now > I have to open the form put in the paramaters and then run the report which > is based on a query... > > I would like to ...

How do I get my MS Pub 2000 to open Pub files from Pub 2003?
i cannot get my Publisher 2000 to open files from Pub 2003....do i have to buy Pub 2003? or is there a solution that I can download? I have already disabled my antivirus and that didn't do anything.. also my files are not "read only". pls help. thx. Novice Novice <Novice@discussions.microsoft.com> was very recently heard to utter: > i cannot get my Publisher 2000 to open files from Pub 2003....do i > have to buy Pub 2003? or is there a solution that I can download? I > have already disabled my antivirus and that didn't do anything.. also > my files ...

Publisher 2000
After I open the Publisher 2000 program and attempt to open a file or create a new document, I get the message "Microsoft Publisher 2000 Version 6.0 has encoountered a problem and needs to close. WE are sorry for the inconvenience". I tried repairing the program and even reinstalling it, but that did not correct it. Suggestions? If you are trying to use Publisher on a network - don't it is not intended for a network Publisher files have to be worked on and saved to the local hard drive ONLY. -- Hi tom (tevanz@bellsouth.net), in the Microsoft� newsgroups you posted: ...

Save as comma csv problems
Hello, I hace Excel 2002. I have near 6000 addresses and contacts and wish to save the xls to a comma csv. I have done that before and then imported the comma csv into my membership program were it says 'import comma csv'. The problem is that some (300 odd) of the records are not imported correctly. I think this maybe because here are some commas in some of the fields eg 24 my street, whatever. Would that be the cause, and if so how can I get rid of all the commas? Many thanks rock I bet it's the way that your membership program works. I'd try this against a copy ...

Problem trying to open old money file
Hi, I am trying to open a four-month old money file, which was on my backup disk. It is a *.mny file, not a backup file. It was created using the same version of Money (2005) which I still use. When I start MS MONEY and try open my old data file, it tells my that it wants convert my file so it works with this version. (Not sure why as the file was created in this version of MS Money). Then when I try and carry out the conversion it gives the following error message. "Money cannot locate xxxx or cannot open it, possibly because it is a read-only file or you do not have...

OL 2003 .nk2 file clears on reboot
We have a client machine whose NK2 file is cleared on reboot. We have tried creating deleting the nk2 file to have OL create a new one, created a new OL profile with no luck. When we copied another users nk2 file to his directory and renamed it to his profile the data is picked up, but no new address are stored. outlook writes to the file when it closes - so it seems outlook is not closing correctly. is there a pda or an application using outlook data? if so, close it first. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? h...

opening links in outlook
why i can not open links attached to my e-mails mike wrote: >why i can not open links attached to my e-mails > I think you did some mistake in typing so just do one thing first type the link in notepad and then direct copy and paste that in your mail. -- Stellar Information Systems Ltd. D18, Sector-33, Infocity Phase II, Gurgaon-122001 Phone : (0124) 326 6069, 432 6700 Website : http://www.stellarinfo.co.in/ What happens when you try? Do you get the error; "This operation has been cancelled due to restrictions in effect on this computer" See http://www.m...

amalgamating archive files
I have several archive files and I'd like to combine them into a single one. Is there a way to do this? Thanks. Howie ...

Running Virus Scan Slowing down opening files
3 minutes to open files in excel and word Are you using kaspersky virusscan? It is know for it. If yes please ask you administrator to exclude scan on harddisk or network files in the settings. -- Arien ------------------------------------------------------------------------ Arien's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1892 View this thread: http://www.excelforum.com/showthread.php?threadid=390878 All Virus Scanning can be stopped: If your using Norton Follow the below if you want to open documents much faster Open Norton Click on: Norton Interne...

Email with tiny attachments open slow
Good Day All, I am using Exchange server 200 and Outlook 2003 mail client. I have started to experience with a single machine where all of a sudden reading emails with attachments of any size, even 6k, slows greatly. Just selecting the email item in the list takes at least 30 seconds before the lower pane shows the body of the selected item. No other client has the same problem even while this machine does. The problem seems to disappear at some point and then returns. The machine was connected to a 10Mbps switch so I changed to a 100Mbps switch and Event logs reveal nothing. I have ...

Need an open house sign in sheet
Need an open house sign in sheet That's interesting, but do you have a question about Publisher? -- James Bart: "According to creationism, there were no cavemen." Homer: "Well good riddance, their drawings sucked and they all looked like hippies!" "soozeeque" <soozeeque@discussions.microsoft.com> wrote in message news:1096B15B-9766-4573-9FC2-2053BEC1F34B@microsoft.com... > Need an open house sign in sheet I would suggest keeping it simple. Use a table for the visitors' information and maybe your real estate company's logo...

CSV numeric strings
I'm having a little "fun" creating a CSV file from an ASP page for use with Excel and hope someone here knows of a trick that doesn't involve user intervention. I am familiar with the format of CSV files - strings containing a comma must be enclosed with double quotes, otherwise just separate all the columns with a comma. But ... Excel tries to be smart about things. If a string, quoted or unquoted, contains leading spaces and/or trailing spaces and/or leading zeros and is otherwise numeric (number groupings, decimal points, positive/negative sign, currency sign, and the c...

cannot open excel file from outlook
Excel 2007 cannot open document eithout first saving and opening thru excel Try to re-register Excel. Close Excel first and On the Windows Taskbar Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe. In that case Start>Run "C:\yourpath\excel.exe" /regserver(quotes required)>OK Gord Dibben MS Excel MVP On Wed, 27 Jan 2010 11:38:12 -0800, Rick <Rick@discussions.microsoft.com> wrote: >Excel 2007 cannot open document eithout first savi...

opening links
Whenever I try to open a link in Outlook XP -- (Win XP Pro) it opens a "open with" prompt/box. Point it to the .exe for your preferred browser and click okay. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual account will be deleted w/out reading. After searching google.groups.com and finding no answer anonymous@discussions.microsoft.com <anonymous@discussions.microsoft.com> asked: | Whenever I try to open a link in Outlook XP -- (Win XP | Pro) it opens a "open with&quo...

Update complete excel file online
Dear all, Hope you can help me with this problem. An excel file is updated on a daily basis and can only be found on the internet. The basic format of this file is always the same, the only changing aspect is the data. How, or if even possible, could I implement something (e.g. a button?) which automatically implements the updated sheet from the Internet. I am really looking forward to hearing from you. Thanks a lot and best regards, ...

SheetName (Application.Caller.Parent.Name) Forces Excel to Save File
I have a VBA function in Excel that I have been using for years that will display the sheet name in a cell. The VBA function is as follows: Function SheetName() As String Application.Volatile SheetName = Application.Caller.Parent.Name End Function This works great. However, I have found that if I am using this function if I open a worksheet and not change anything Excel will prompt me if I want to save the worksheet if I have not made any changes. Why is this happening and is there a way to prevent this from happening? Thanks, Mike The problem may be Application.Volitile If ...

Workbook always opens at a specific sheet and cell
I have a workbook consisting of many sheets. How do I make sure that everytime I open the work book, it would directly point to a specific sheet and cell? Hi put the following code in your workbook module (not in a standard module). sub workbook_open() me.worksheets("sheetx").activate end sub -- Regards Frank Kabel Frankfurt, Germany Zee wrote: > I have a workbook consisting of many sheets. How do I make sure that > everytime I open the work book, it would directly point to a specific > sheet and cell? methinks the original poster also wanted to activate a particu...

Best file recovery program?
I need a good file recovery program that will run both under Vista and Win 7. It needs to be able to salvage files both deleted and those lost because of disc errors. It also needs to be able to work with both internal and external hard discs, and all flavors of CD and DVD. Any recommendations? Most of the ones that allow you to download a trial have crippled to trial so much that it's really hard to judge them. Incidentally, I ran the free Recuva on a DVD-RW; I started it at 12:30 PM and at 5:30 AM (17 hours later) it showed 89% complete, and at 8:00 it had stopped with th...

using my Money 2005 file on two different computers
I use MS Money 2005 for my personal financle data. My Money file lives on my computer. I want to have my bookkeeper enter data into this file. I want to be able to have her work on the data from her computer which is networked to my computer. We have tried opening the file from her computer over the network with no sucess. We can see the file but the password does not work. We have tried burning the file to a CD but when we try to open the file from her computer we can get the password to work. The same thing that happens when we try to restore a backup on her computer. We tried usi...

unable to open your default mail folders...
I am running XP Pro and Office XP 2002. I currently use Outlook express on this PC but want to switch over to Outlook. When I try to open Outlook I get the message- Unable to open your default mail folders. Could not open item. Try again. Any ideas what's going on ??? Thanks in advance!!! -- Dennis Have you created a mail profile and installed your mail account(s)? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scrat...

EXCEL Files open Slow
Why is it that when I open associated files for Office 2007 (.xlsx and ..docx) that they open SLOW (approx 15 seconds). However, if I have Excel or Word open and then attempt to open specific files, they open in a snap ? I have Office 2007, Vista Home Prsmium, a 2.4 Quad Core system, and four gigs of ram. Can someone please explain this and help me out ? Thanks. Hi, If I get your point - when you open the files in the Window Explorer (outside of Excel) it takes longer. Sometimes that if because Excel needs to launch, and that can be slower than just opening a file from inside of Excel...

Opening a second mdb file from an open mdb file
I have two mdb files (one used for general department use and the other for detailed reporting). For ease of maintenance, I'd like to keep these mdb files separate, but I would like to have the ability to open the second mdb file from the general dept Access program. Is there an exisitng macro or VBA code I could use to accomplish this task? Thanks for your help. Sure, you can easily just shell out to another app: http://www.mvps.org/access/api/api0018.htm or even create a hyperlink that opens the file. Just create a label, go to the property sheet and enter a path in the hype...

ost file #2
My Exchange account was deleted from my Outlook today. All of my data is in the .ost file. Is there any way to recover the data into a .pst file? I am having trouble reinstalling the Exchange account. Any suggestions would be appreciated. Thanks. assuming that the ost is still attached to your profile, just start the computer with no network connection. Logon to your windows box like normal and then start Outlook. Go into offline mode and export to a pst. if the ost is no longer associated to a profile, copy it off somewhere for safe keeping and then try the following. create a n...

Directory Open
Hi, I would like to create a Button which opens a dialog box, not to open a file but to open a directory. How should I do it? I thought of using CFileDialog but it does not allow for opening just a directory and not a file. I just want to read in the user selection of directory and the file name will be set in my application. Thanks! On Wed, 17 Dec 2003 22:15:36 -0800, Dave wrote: > I would like to create a Button which opens a dialog box, > not to open a file but to open a directory. > > How should I do it? > I thought of using CFileDialog but it does not allow for ...