Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save and SaveAs 1

Status
Not open for further replies.

beanbrain

Programmer
Dec 31, 2001
170
I am currently manipulating a worksheet that was exported via Paradox in Excel (xls) format. The primary reason is to add some mathmatical functions and format the spreadsheet for printing. I've noticed that one of the functions I'm using is causing the save to prompt me for a newer excel format. So in an attempt to stop the prompting I used the SaveAs function of Worksheet to try to forstall this prompting. It worked after a fashion as you will see below, but now I'm being prompted because the file already exists. I would prefer to pass the Worksheet.SaveAs function a "Yes" or "True" so this prompting ends.

The reason of the file format change is the following function:

=countif(Range,"criterion")

Interestingly Paradox help states that saving with an xls extension will save to Excel 3.0/4.0 and 5.0. But it's obvious that it's actually 3.0 without the option for a higher version number.

The code I'm currently using is:

ActiveWorkbook.ConflictResolution = xlLocalSessionChanges
If ActiveWorkbook.FileFormat = xlExcel3 Then
ActiveWorkbook.SaveAs FileFormat:=xlExcel7
End If

The ConflictResolution parameter ends the first problem, but because the spreadsheet already exists and I'm overwriting it the statement inside the If is prompting me for a save.

Finally, I noticed when fooling around this statement that I was able to have it evaluate to a true or false. This what leads me to believe I can use a Boolean state to save without prompting.

Thanks
BeanBrain
"Remember there's a big difference between kneeling down and bending over." -- Frank Zappa
 
beanbrain,

did you try
docmd.setwarnings false
application.displayalerts false

then just set back to true.
one of these should help.

regards,

longhair
 
LongHair:

docmd.setwarnings false
application.displayalerts false

Neither of these seem to lend themselves to Excel VBA.

Thanks,
BeanBrain

"Remember there's a big difference between kneeling down and bending over." -- Frank Zappa
 
Don't forget the = sign.

Application.DisplayAlerts = False

Regards
Ken.............
 
Yup. That did it. And here I was looking for additional funcationality to Worksheet.SaveAs.

Of course setting this back to true is pretty important.

BeanBrain
"Remember there's a big difference between kneeling down and bending over." -- Frank Zappa
 
> Of course setting this back to true is pretty important

And very remiss of me for not caveating with that as well. :-(

Regards
Ken................
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top