changing filename when exporting to excel

G

Guest

I am exporting to an excel file called equip.xls. I want to export to a
filename that is dependent upon a value in a text box on a form. For example
equip75.xls (where "75" was in a text box). I tried "equip"&"[text0].xls",
but no luck. Any ideas?
 
A

andromeda

pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
 
J

Joe Fallon

Something like this should work:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "TableName",
"c:\mydocs\excel\" & txtFileName & ".xls", True, "MyNamedRange"
 
G

Guest

Thanks, I tried this but I get an error on "acexport" saying invalid
procedure. I'm not a vb expert - trying to just use the macro, when I use the
same path in a macro, I get an error that the spreadsheet is read only (but
it hasn't even created it yet).



Joe Fallon said:
Something like this should work:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "TableName",
"c:\mydocs\excel\" & txtFileName & ".xls", True, "MyNamedRange"
--
Joe Fallon
Access MVP



Amy said:
I am exporting to an excel file called equip.xls. I want to export to a
filename that is dependent upon a value in a text box on a form. For
example
equip75.xls (where "75" was in a text box). I tried
"equip"&"[text0].xls",
but no luck. Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top