Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default SAVE AS MACRO

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default SAVE AS MACRO

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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default SAVE AS MACRO

There is a problem with your VBA code (the macro).

if you open up your visual basic editor, and look at the module
containing the code (or click debug when you get this message, you want
to insert the following code (but adapt it accordingly)

If(whatYouTyped="no") Then
MsgBox "File not overwritten."
Exit Sub
End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default SAVE AS MACRO

My macro is as follows:-
'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

"Ninja Stevie" wrote:

There is a problem with your VBA code (the macro).

if you open up your visual basic editor, and look at the module
containing the code (or click debug when you get this message, you want
to insert the following code (but adapt it accordingly)

If(whatYouTyped="no") Then
MsgBox "File not overwritten."
Exit Sub
End If


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default SAVE AS MACRO

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.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default SAVE AS MACRO

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.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default SAVE AS MACRO

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.






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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.








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default SAVE AS MACRO

Harald i thanks a million !!
Could you possibly tell me what the code (and where to put it) is to stop
the excel
exit button offering a save option ? I don't want the user to be able to
save the workbook they are working in. Thanks.
Mike

"Mike" wrote:

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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
Save As macro Tha BeatMaker[_4_] Excel Programming 1 June 16th 05 07:41 PM
ASP: Open Excel File with Macro, Allow Macro to run, and then save delgados129 Excel Programming 0 March 10th 05 09:35 PM
Prompted to save changes after macro save - why? Izar Arcturus Excel Programming 2 December 10th 03 09:27 PM


All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"