Consulting

Results 1 to 2 of 2

Thread: Auto unformatting of output filename with leading zeroes

  1. #1

    Auto unformatting of output filename with leading zeroes

    I am trying to save a chart out of excel with a file name of the format 'run-001_plot-001.png'. The following code works correctly apart from the fact that the programme is auto deleting the leading zeroes from 'Format(j,000)' to 'Format(j,0):


    ActiveSheet.ChartObjects(1).Chart.Export filename:=output_directory & "\" & "run-" & Format(j, 0) & "_" & file_name & "." & output_file_type
                .Shapes(MyChart).Delete
    I read something explaining that it was due to the file being written rather than read but didn't fully understand it. Any ideas?

  2. #2
    Forget I even asked, I was being stupid. The code should be 'Format(j, "000")'.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •