Solved

Excel Macro Issue

Posted on 2011-02-23
2
305 Views
Last Modified: 2012-05-11
Good Afternoon,

I am using Office 2010. I have an excel file which I filter certain data and then run this macro:

Sub Save()
'
' Save Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
    Sheets("Email Data").Select
    ChDir "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)"
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Email Data.csv", _
        FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Letter Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Letter Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Warranty Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Warranty Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
    Sheets("CSI Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\CSI Data.csv", _
        FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Agency Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Agency Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
    Sheets("Company Data").Select
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\amyp\Desktop\Service Reminder (Temp)\Company Data.csv" _
        , FileFormat:=xlCSV, CreateBackup:=False
End Sub

When saving the data as a CSV file, all of the dates are changed from UK format of DD-MM-YYYY to American format of MM-DD-YYYY, even though the dates are shown in the correct UK format prior to running the macro.

Can anyone advise me as to why this is happening?
0
Comment
Question by:ali_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 34962366
0
 
LVL 23

Accepted Solution

by:
Michael Fowler earned 500 total points
ID: 34967458
A suggestion from this forum
http://www.excelforum.com/excel-programming/381953-date-format-problem-on-export-to-csv.html

is to change the dates in the sheet to US format before the save and then for some reason excel will then change them back to UK format on the save.

Michael
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question