SAVE AS MACRO
Hi Mike
It is to replace
ActiveWorkbook.SaveAs Filename:= _
myDir & "\" & myFilename, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
HTH. Best wishes Harald
"Mike" skrev i melding
...
Hi Harald,
I'm a bit thick...
Where do I put the code you suggest ? Or do I replace all my code with
your
version ? I copied/pasted my code from one of your previous helps I think.
Mike
"Harald Staff" wrote:
Sure it crashes. Your code insists on "Save" and Windows says "No save".
Try
If Dir(myDir & "\" & myFilename) = "" Then
ActiveWorkbook.SaveAs Filename:= _
myDir & "\" & myFilename, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Else
MsgBox "File already exists.", vbInformation, "No can do"
End If
HTH. Best wishes Harald
"Mike" skrev i melding
...
Hope this helps.
'Sub SaveMe()
myFilename = InputBox("Enter filename") & ".xls"
myDir = "C:\documents and settings\mike\my documents"
ActiveWorkbook.SaveAs Filename:= _
myDir & "\" & myFilename, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
"Harald Staff" wrote:
Hi Mike
Post the macro please.
Best wishes Harald
"Mike" skrev i melding
...
I have a "Save As" macro. When activated a box appears asking for
a
file
name.
If the the file name already exists a prompt asks if the existing
file
should be over -
written. If I answer YES there is no problem. If I answer NO a VBS
prompt
asks if I
want to END or DEBUG. Ideally if the answer is NO I would want to
return
to
the sheet the macro was in. Mike.
|