0

If I have an Excel worksheet with a single cell populated with 09:00:00 and export it manually as 'Text (tab delimited)' it outputs a text file containing 09:00:00.

However, if I write the following macro:

Sub SaveAsTextTabSeparated()
    Dim Filename As String
    Filename = CreateObject("WScript.Shell").specialfolders("Desktop") & "\" & "test-macro.txt"
    ActiveWorkbook.SaveAs Filename, xlText
End Sub

The output is then 9:00:00 without the leading 0.

I've tried several of the XlFileFormat options as show here but they all exhibit this behaviour.

Have I missed some additional argument for the SaveAs method or is it not possible to replicate the behaviour of the manual export?

pnuts
  • 56,678
  • 9
  • 81
  • 133
Scroog1
  • 3,399
  • 21
  • 25
  • 2
    http://stackoverflow.com/questions/22804699/use-comma-instead-of-dot-for-decimals-when-saving-as-text/22804879#22804879 –  Apr 16 '14 at 08:00
  • Adding `Local:=True` appears to the solution. Thanks. – Scroog1 Apr 16 '14 at 08:02

0 Answers0