Link to home
Start Free TrialLog in
Avatar of Ronald Malk
Ronald MalkFlag for Australia

asked on

Excess tables to Excel BackUp

I have this code below I know is poorly added up but still working creating back up for six tables in Six sheets in one Excel file but it gets created only in my documents folder, what I need is to direct the back up to a folder on the desktop and if possible maybe some reshape to the code because as you see in my code  I'm naming the destination file with every table is this OK ?    (I'm using 2010 office)

Dim OutputFileName As String
OutputFileName = "C:\Users\Orly\Desktop\backups"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Tbl_Stock_Main", Format(Now, "yyyyMMdd hh mm"), True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Tbl_Stock_Orders", Format(Now, "yyyyMMdd hh mm"), True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Tbl_Stock_Prchs", Format(Now, "yyyyMMdd hh mm"), True
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Tbl_Stock_Main", OutputFileName &"\" &  Format(Now, "yyyyMMdd hh mm"), True

or

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Tbl_Stock_Main", OutputFileName &"\NameOfTable_" &  Format(Now, "yyyyMMdd hh mm"), True
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ronald Malk

ASKER

That was quick, It' s working good, Thanks mate, Thank you so much