Remove prompt for replacing file

S

Song Su

Access 2007 SP2

My macro action 'OutPutTo' has following arguments:

Object Type: Report
Object Name: rptAutoSubjSU
Output Format: PDF Format (*.pdf)
Output File: Summer by Course.pdf

I want to put this macro on Windows schedule task to run unattended.
How to suppress prompt: "The file already exist. Do you want to replace?" on
each run?

Thanks
 
S

Steve Schapel

Song Su,

There may be a way to do this in a macro, but if so I can't find it.

The only way I know is to use VBA procedure instead of macro. That way, you
can test the existence (use Len(Dir(Path&File))) of the file already, and if
it exists, delete it (use Kill method) before OutputTo.

Only other thing you can do is uniquely name the file each time you output,
for example by adding date stamp to the file name.

--
Steve Schapel, Microsoft Access MVP


Song Su said:
Access 2007 SP2

My macro action 'OutPutTo' has following arguments:

Object Type: Report
Object Name: rptAutoSubjSU
Output Format: PDF Format (*.pdf)
Output File: Summer by Course.pdf

I want to put this macro on Windows schedule task to run unattended.
How to suppress prompt: "The file already exist. Do you want to replace?"
on each run?



__________ Information from ESET Smart Security, version of virus signature database 4193 (20090626) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Song Su

Steve Schapel,

I maybe able to figure out using VBA to create pdf and overwrite existing
file. Even if I can, how to use macro to run that VBA? Because I want to use
Windows Scheduler to run unattended and only macro can do this.

Song
 
S

Steve Schapel

Song,

Make the VBA code as a function in a standard module. Then you can use a
macro with a RunCode action to call the function.

--
Steve Schapel, Microsoft Access MVP


Song Su said:
Steve Schapel,

I maybe able to figure out using VBA to create pdf and overwrite existing
file. Even if I can, how to use macro to run that VBA? Because I want to
use
Windows Scheduler to run unattended and only macro can do this.

Song



__________ Information from ESET Smart Security, version of virus signature database 4193 (20090626) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Song Su

Steve,

It works great! Thanks a lot.

Song

Steve Schapel said:
Song,

Make the VBA code as a function in a standard module. Then you can use a
macro with a RunCode action to call the function.

--
Steve Schapel, Microsoft Access MVP






__________ Information from ESET Smart Security, version of virus
signature database 4193 (20090626) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Steve Schapel

Very good, Song. Thanks for letting us know!

--
Steve Schapel, Microsoft Access MVP


Song Su said:
Steve,

It works great! Thanks a lot.



__________ Information from ESET Smart Security, version of virus signature database 4193 (20090626) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 

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