|
I've got a user who's trying to export a text file with unicode
formatting. When he exports it as straight ascii, some of the foreign
characters (mostly just accent marks and the like - no non-roman
characters that I can see) don't come through right. So he needs it in
Unicode formatting. He's using code for the DoCmd.OutputTo command.
There's a very undocumented Encoding option for that command, but no
options are specified and there's precisely squat online. So I figured
if it was a DoCmd line that I could do the same thing with a macro.
Wouldn't you know it, I could specify the unicode option in the macro
and the file would output correctly! Problem is, he's got a batch of
these things, and the filename changes - the name is taken from the
object number he's reporting on. I tried specifying in the macro sheet
that the filename is:
"c:\dmpfiles\" & [Forms]![smi_one]![cdnum] & ".txt"
but that caused an error in the macro execution. Interestingly enough,
when the halt screen came up it showed the variables it was passing to
the actual OutputTo command, and the encoding option was the number
1200. So I went back into the code and tried specifying 1200 as the
encoding option. It's weird - the macro creates a unicode file when it
passes the 1200 argument, but the vba doesn't, even though it's passing
the exact same variables. So, I thought, no big deal - I'll just edit
the macro right before it runs. Maybe I wasn't looking in the right
place, but I couldn't find any why of modifying an existing macro. My
thought is to just edit the macro before it runs and giving it the
filename it should save as. Anyone know how to use VBA to edit a macro?
Better yet, any way to get the DoCmd.OutputTo to actually output in
Unicode format? |