PIsabel
Board Regular
- Joined
- Feb 4, 2014
- Messages
- 126
- Office Version
- 365
- Platform
- Windows
Hello.
I am trying to create a macro that every time I close the file the macro makes a copy of that file.
So far I have this but it still does not work well.
Someone can help me?
Thank you, Isabel
I am trying to create a macro that every time I close the file the macro makes a copy of that file.
So far I have this but it still does not work well.
Someone can help me?
Thank you, Isabel
Code:
Sub auto_close()
If ThisWorkbook.Path = "[URL="file://\\Servidor\servidor\ORÇAMENTOS\orç"]\\Servidor\servidor\ORÇAMENTOS\orç[/URL] - A Fazer" Then
Opções.Show
If Sheets("PVP").Visible = True Then
thisfile = Range("e3") & (" - nº ") & Range("I2") & " - " & Format(Now, "yyyy-mm-dd hh-mm")
ActiveWorkbook.SaveAs Filename:="[URL="file://\\Servidor\servidor\Arquivo"]\\Servidor\servidor\Arquivo[/URL] orçamentos\Seguranças" & thisfile
If Sheets("Profissional").Visible = True Then
thisfile = "- Orçamento - profissional - " & Range("e3") & " - nº " & Range("j2") & " - " & Range("e8") & " - " & Format(Now, "yyyy-mm-dd hh-mm")
ActiveWorkbook.SaveAs Filename:="[URL="file://\\Servidor\servidor\Arquivo"]\\Servidor\servidor\Arquivo[/URL] orçamentos\Seguranças" & thisfile
End If
End If
End If
End Sub
Last edited: