View Full Version : Saving an Excel file using SaveAs with no confirm


Myriad_Rocker
03-22-2007, 12:00 PM
I'm needy today. I've searched multiple phrases on this forum and can't seem to locate a solution to this issue.

I'm currently building an Excel file in Access. There's a point where I open a file and add to it and just want to save it and move on. Problem is, I have only one "Send To Excel" module and I'd like to keep it that way.

So...when I do the SaveAs, is there a way to get the replace Yes/No box to just go away and save anyway? If I change it to just Save, it will save over my template and I don't want that.

Hope that rambling made sense...

rainman89
03-22-2007, 12:06 PM
The save as action is goign to require a name no matter what. Thats its job!

to save it automaticcally u should probably come up with some VB code to uniquely identify each excel file, or change the name of the file before you save it. also can be done in vb.

boblarson
03-22-2007, 12:06 PM
You should be able to use

DoCmd.SetWarnings False
Do the save as here
DoCmd.SetWarnings True

But also put the one to set them to true as the first thing in an error handler, otherwise you could find yourself without warnings at all.

boblarson
03-22-2007, 12:09 PM
The save as action is goign to require a name no matter what.

Yep, you can supply the name in a Save As using VBA.

Myriad_Rocker
03-22-2007, 12:20 PM
I have already tried setting the warnings to false. It didn't work. It still asked me if I wanted to replace the file.

DoCmd.SetWarnings False
xls.ActiveWorkbook.SaveAs filename:=filelocation
DoCmd.SetWarnings True