Skip to main content

scripts exports an excel file every end of the month,

Hello.
my scritps  exports an excel file every end of the month, my question is if I can put the date with a file name in the export, example  6/30/2022_Balanc_General, but not manual, as it will change month by month. You can or some suggestion, this to create a repository to create statistics per month

Brian Element Tue, 09/13/2022 - 10:19

You can use the Now() function (this will return the current date) combined with the Format() function to add the date to your filename, here is an example:


Sub Main
	Dim newFilename As String
	newFilename = "Monthly file for " & Format(Now, "YYYYMMDD") & ".IMD"
	MsgBox newFilename
End Sub

ortizmario6025… Tue, 09/13/2022 - 10:38

Good, thanks.
where could it be placed?
' Archivo-Exportar base de datos: XLSXFunction ExportDatabaseXLSX1Set db = Client.OpenDatabase("Saldo_Gral_Prestamos.IMD")Set task = db.ExportDatabasetask.AddFieldToInc "ACC"task.AddFieldToInc "PRE_NOMBRE"
task.AddFieldToInc "PRE_STATUS"
task.AddFieldToInc "STA_DESCRIPCION"
task.AddFieldToInc "TIP_DESCRIP"
task.AddFieldToInc "BALTYPE"
task.AddFieldToInc "BALTRCY"
task.AddFieldToInc "DES_ACCENTRYTYPE"
task.AddFieldToInc "PRE_FECEMI_FECHA"
task.AddFieldToInc "PRE_FECVEN_FECHA"
task.AddFieldToInc "PRE_FECANCE_FECHA"
task.AddFieldToInc "PRE_VALORCUOTA"
task.AddFieldToInc "PRE_NUMPER"
task.AddFieldToInc "PRE_PLAZO"
task.AddFieldToInc "PRO_PROPOSITO"
task.AddFieldToInc "CY"
task.AddFieldToInc "ACCENTRYTYPE"
eqn = ""
task.PerformTask "D:\Exportacion data\Saldos Dario Productos\Saldo_Gral_Prestamos.XLSX", "Database", "XLSX", 1, db.Count, eqn
Set db = Nothing
Set task = Nothing
End Function

Brian Element Tue, 09/13/2022 - 11:41

Maybe something like this:

task.PerformTask "D:\Exportacion data\Saldos Dario Productos\Saldo_Gral_Prestamos_" & Format(Now, "YYYYMMDD") & ".XLSX", "Database", "XLSX", 1, db.Count, eqn