Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
dear all,
i want to export a excel with today's date.
suppose fileName is employee then expoted file should be employee_03-02-2011.xls
Regards
Sunil
Hi Sunil,
I have this example, you can try
Function Correos()
Set Doc = ActiveDocument
Set DocProp = Doc.GetProperties
Directory = DocProp.MyWorkingDirectory
Doc.GetApplication.Refresh
Set AppExcel = CreateObject("Excel.Application")
AppExcel.Visible = True
AppExcel.WorkBooks.Add()
Set Gra01 = Doc.GetSheetObject("CH16")
Set Gra02 = Doc.GetSheetObject("CH17")
Set Txt01 = Doc.GetSheetObject("TX13")
// ***************** Se realiza filtro de Negocio y Dummy **********************************************
ActiveDocument.ClearAll false
ActiveDocument.Fields("Cia").ToggleSelect "010"
ActiveDocument.Fields("Cia").ToggleSelect "100"
ActiveDocument.Fields("Cia").ToggleSelect "500"
ActiveDocument.Fields("Cia").ToggleSelect "700"
ActiveDocument.getApplication.sleep 5000
AppExcel.Sheets.Add()
Txt01.CopyTextToClipboard
AppExcel.ActiveSheet.Cells(1,3).Activate
AppExcel.ActiveSheet.Paste
AppExcel.ActiveSheet.Name = "Stock PT"
AppExcel.ActiveSheet.Cells(4,1).Activate
Gra01.CopyTableToClipboard True
AppExcel.ActiveSheet.Paste
AppExcel.ActiveSheet.Columns("B").Delete
AppExcel.ActiveSheet.Range("B5:AZ20").NumberFormat = ("#,##0")
AppExcel.ActiveSheet.Columns("A").ColumnWidth = 40
AppExcel.ActiveSheet.Columns("A").AutoFit
ActiveDocument.getApplication.sleep 5000
Set Gra02 = Doc.GetSheetObject("CH17")
Gra02.CopyBitMapToClipboard
AppExcel.ActiveSheet.Cells(17,1).Activate
Gra02.CopyBitMapToClipboard
AppExcel.ActiveSheet.Paste
AppExcel.ActiveSheet.Cells(1,1).Activate
// ********************* Salva y Cierra el Excel ***************************************
Ruta = Directory & "\Stock" & Year(Now) & Month(Now) & Day(Now) & " a las " & Hour(Now) & Minute(Now) & Second(Now) & ".XLS"
AppExcel.ActiveSheet.SaveAs (Ruta)
End Function
is there any other way