[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

Suppress "Do you want to replace the Existing File" in an AutoExec macro

I've written an AutoExec macro that works fine, running a series of queries.  However, when it comes to an Output command to an existing report that I want to replace, the prompt "The file already exists.  Do you want to replace the existing file" stops the macro from continuing until I answer the question Yes.  I've searched ExpertsExchange for a similar question, and tried creating a Global Function which I include as one of my first macro steps.  The function is ActionQueryConfirmation(False).  This doesn't work, I'm still prompted "Do you want to replace the existing file Yes/No".  I'm wanting to run this macro every morning, creating 3 new reports for the users to have available first thing.  
Public Function ActionQueryConfirmation(NewValue As Boolean)
    Application.SetOption "Confirm Action Queries", NewValue
End Function

Open in new window

0
KarenPRuskin
Asked:
KarenPRuskin
  • 2
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
Hi KarenPRuskin,

Have you tried SetWarnings = No in the macro ?

jpaulino
0
 
KarenPRuskinAuthor Commented:
Yes, I do this at the beginning of the macro.  
0
 
ldunscombeCommented:
You could try deleting the file before you recreate it in your function as follows

Public Function ActionQueryConfirmation(NewValue As Boolean)

Dim delfile as string
delfile = "C:\<Your Directory>\<Your File> 'Set delfile as the "Full Path to the file you want to delete including the file extension.
Kill (delfile) ' Delete the file

    Application.SetOption "Confirm Action Queries", NewValue
End Function

Leigh
0
 
KarenPRuskinAuthor Commented:
Worked absolutely perfectly Leigh.  Thank you so much, I appreciate your prompt response ... not to mention your expertise!  Cheers, Karen
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now