ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ability to embed a macro within a csv (https://www.excelbanter.com/excel-discussion-misc-queries/20346-ability-embed-macro-within-csv.html)

n30

ability to embed a macro within a csv
 
situation: I am created a sceduled task within an ACCESS
dB to export out information to a .csv network file share.
The problem is that the date field is illegible it appears
in date-time format and when opened appears as
2.00512E+13. The ACCESS export is always writing over the
same file.

Is it possible to create a macro within this network file
share .csv which will format the columns, perform a LEFT
(datefield,8) on the date field trimming off the time so
that just the date appears as 20051231 and then format
this date field to appear as 12-31-2005 and then sort the
entire worksheet by date while assigning this macro to a
smiley face as a custom command on the toolbar also with
autoexec feature.

The objective being that all users throughout the network
will have a shortcut on their desktop pointing to the
network .csv file share so the macro is invoked upon
opening the file and the user can then look at a file
which makes sense vis-a-vis the date field.

Note: I attempted this but I was not able to save the
macro to the .csv. WHen I reopened the .csv I receive an
error message that the macro created cannot be found.

Thank you very much in advance!



Ron Coderre

It seems to me that if the dates in the Access generated CSV were formatted
in m/d/yyyy format you wouldn't run into the problem. Excel would translate
the date-like text into actual Excel dates, then you wouldn't need any kind
of macro.

Is there a reason that can't be done?

Regards,
Ron




This has not been possible to date but I will get back to
you after I recreate the ACCESS .csv export with actual
data. Unfortunately I do not have the actual export with
me and do not remember the format ACCESS is exporting out
the date-time in the csv file.

Thank you for such a quick response!


-----Original Message-----
It seems to me that if the dates in the Access generated

CSV were formatted
in m/d/yyyy format you wouldn't run into the problem.

Excel would translate
the date-like text into actual Excel dates, then you

wouldn't need any kind
of macro.

Is there a reason that can't be done?

Regards,
Ron


.


Earl Kiosterud

A csv file is not application-specific, and contains only text anyway, by
definition. So there's no way for a macro to be in it. This sounds like
Access is writing the date in a format that your Excel doesn't recognize as
a date (depends on your regional settings).

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"n30" wrote in message
...
situation: I am created a sceduled task within an ACCESS
dB to export out information to a .csv network file share.
The problem is that the date field is illegible it appears
in date-time format and when opened appears as
2.00512E+13. The ACCESS export is always writing over the
same file.

Is it possible to create a macro within this network file
share .csv which will format the columns, perform a LEFT
(datefield,8) on the date field trimming off the time so
that just the date appears as 20051231 and then format
this date field to appear as 12-31-2005 and then sort the
entire worksheet by date while assigning this macro to a
smiley face as a custom command on the toolbar also with
autoexec feature.

The objective being that all users throughout the network
will have a shortcut on their desktop pointing to the
network .csv file share so the macro is invoked upon
opening the file and the user can then look at a file
which makes sense vis-a-vis the date field.

Note: I attempted this but I was not able to save the
macro to the .csv. WHen I reopened the .csv I receive an
error message that the macro created cannot be found.

Thank you very much in advance!






All times are GMT +1. The time now is 04:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com