Jumat, 20 Juli 2012

[ExcelVBA] Re: How do you skip over or pre-answer an EXCEL dialog box?

 

I am trying to make this Macro End-User proof. So, in the MACRO, I have code in there to save the Workbook. I execute the statement that saves the Workbook. Next, I use the ActiveWorkbook.Close SaveChanges:=False statement. It is on this statement that I get that prompt instructing me to answer Yes, No, or Cancel. It is this prompt that I want to skip over and make it End-User proof. When I added the Application.DisplayAlerts = False statement before my ActiveWorkbook.Close statement, it worked. I didn't get that prompt any more.

Thank you again for your help.

--- In ExcelVBA@yahoogroups.com, Paul Schreiner <schreiner_paul@...> wrote:
>
> That doesn't make any sense.
> ActiveWorkbook.Close SaveChanges:=False
>
> says to close the workbook without saving.
> So it shouldn't be checking to save.
>
> You said that you're trying to save the workbook as an .xlsx file.
> that's not what
> ActiveWorkbook.Close SaveChanges:=False
>
> is doing...
> so.. I think we need some clarification on what you're trying to do.
> Are you saving it as .xlsx
> or are you exiting without saving?
>
> If you're wanting to exit without saving, you can use:
> Activeworkbook.Saved = true
>
> if you simply don't want to see prompts, you can use:
>
>     Application.DisplayAlerts = False
>
> If you want to save the current workbook as a .xlsx file format (removing all
> macros)
> without having a warning prompt, use:
>
>     Application.DisplayAlerts = False
>     ThisWorkbook.SaveAs "C:\temp\SaveTestNew", FileFormat:=xlWorkbookDefault
>
>  
> Paul
> -----------------------------------------
> “Do all the good you can,
> By all the means you can,
> In all the ways you can,
> In all the places you can,
> At all the times you can,
> To all the people you can,
> As long as ever you can.” - John Wesley
> -----------------------------------------
>
>
>
>
> ________________________________
> From: danielrose02 <dan.rose@...>
> To: ExcelVBA@yahoogroups.com
> Sent: Tue, July 17, 2012 7:44:37 AM
> Subject: [ExcelVBA] How do you skip over or pre-answer an EXCEL dialog box?
>
>  
> I finished my expansion of my VB Macro to compare two spreadsheets. When I try
> and save the .XLSM to a .XLSX file, I am receiving a prompt that reads as
> follows:
>
> The Title contains "Microsoft Excel"
>
> The body of the dialog box reads as follows:
>
> The following features cannot be saved in macro-free workbooks:
>
> . VB Project
>
> To save a file with these features, click No, and then choose a macro-enabled
> file type in the File Type list.
>
> To continue saving as a macro-free workbook, click Yes.
>
> The buttons that appear are:
>
> Yes, No, and Help
>
> I would like to force the Yes button.
>
> How do I do that?
>
> The statement that this is trying to execute in my Macro is:
>
> ActiveWorkbook.Close SaveChanges:=False
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar