1 Reply Latest reply: Feb 14, 2017 11:14 AM by Sunny Talwar RSS

    Date in csv extract file name

    P M

      Hi

       

      I have a table that export from a small macro.

      How can I add the date and time to the file name please.

       

      Sub ExportToFile

       

      set sObject = ActiveDocument.GetSheetObject("SoOpen")

      sObject.Export "\\local\Mine\OpenSalesOrders.csv", ", "

       

       

      End Sub

       

       

      I want it to be:

       

      OpenSalesOrders_YYYY-MM-DD-hh-mm.csv

       

      Thanks all

        • Re: Date in csv extract file name
          Sunny Talwar

          May be something like this (I have not tested this):


          vTime = ActiveDocument.Evaluate("TimeStamp(Now(), 'YYYY-MM-DD-hh-mm')")


          set sObject = ActiveDocument.GetSheetObject("SoOpen")

          sObject.Export "\\local\Mine\OpenSalesOrders_" & vTime & ".csv", ", "