Changing date format in a file export from excel t
|
Excel VBADiscuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Changing date format in a file export from excel t
I have a macro running in excel 2003 that exports date and a event text field to a javascript file, however the macro was wrote for American systems and I am in the UK. Below I have included the VBA that is responsible for the conversion of the date from "14-Jul-2004" format to "yyyymmdd" format.. supposedly! It however appears to convert to "yyyyddmm" format as long as the day is under 13!!???
Any help or suggestions please..
____________________________________________
Private Function cal_cmd(calEvent) As String
'Purpose: Convert event properties array into event command string
' convert date to yyyymmdd date code
calEvent(0) = Application.WorksheetFunction.Text(calEvent(0), "yyyymmdd")
' set undefined image sizes to zero (29-Apr-2004: image size parameters now optional)
'If Not IsNumeric(calEvent(6)) Then calEvent(6) = QUOTE & QUOTE
'If Not IsNumeric(calEvent(7)) Then calEvent(7) = QUOTE & QUOTE
cal_cmd = CMDBEG & calEvent(0) & DELIM
For i = 1 To EVENTCOLUMNS - 1
cal_cmd = cal_cmd & QuoteWord(calEvent(i)) & DELIM
Next i
cal_cmd = cal_cmd & QuoteWord(calEvent(EVENTCOLUMNS)) & CMDEND