VBA Save As problem file already exist

Joined
Jul 16, 2013
Messages
2
Reaction score
0
Hello,

I have a macro that runs each time when i open my file. I also wanne to use scheduler task so it runs everyday.

But i have in the macro also a save as and the problem is when i open it for the first time i have no problem. But when i open it for a second time he pop-ups the question if i want to replace the file.
I don't want him to ask it (or even do a save as) .

I would like him to do only the save only once a day.

i was thinking in the way of
"if file excist then don't do a save as otherwise do a save as."

beneath you can see what i for my save as:

Private Sub Workbook_Open()
...

ThisWorkbook.Save
Dim filenaam As String
Dim Sysdate

Sysdate = Format(Date, "ddmmyy")

filenaam$ = "F:\Users\Procurement\Contracts\Contract Files\" & "Contract File" & "_" & Sysdate & ".xlsx"
ActiveWorkbook.Sheets.Copy
ActiveWorkbook.SaveAs filenaam$, FileFormat:=51
ActiveWorkbook.Close


Kind regards,

Les
 
Joined
Jul 16, 2013
Messages
2
Reaction score
0
that one i already found to but it can't help me or don't know how to apply to my problem.
 

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

Similar Threads


Top