Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping error


Below is a macro i have made that saves the file name like i want it too
using data from the worksheet. The problem is if they file name has
been used before, which it shouldnt have but could have accidently been
saved, it asks if you would like to save over this. if you click no
then it crashes.

Is it possible to set it that if u click no it just ends the macro.

thanks

Sub SAVEAS_NEW_FNE()
Dim FN As Workbook
Dim D As Variant
[D] = Format(Range("B3"), "mm_dd_yyyy")
ThisWorkbook.SaveAs Filename:="FNE " & [D]
End Sub


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile: http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538749

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Stopping error

Hi,

if you want simply prevent raising error use on error resume next.

Better way is to check if the filename is already used, have a look at:

http://www.j-walk.com/ss/excel/tips/tip54.htm

regards,
Ivan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Stopping error

Sub SAVEAS_NEW_FNE()
Dim FN As Workbook
Dim D As Variant
Dim sFilename As String

[D] = Format(Range("B3"), "mm_dd_yyyy")
sFilename ="FNE " & [D]
If Len(Dir(sFilename)) = 0 Then
ThisWorkbook.SaveAs Filename:="FNE " & [D]
Else
Msgbox sFilename & " already exists"
End If
End Sub


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"XCESIV" wrote in
message ...

Below is a macro i have made that saves the file name like i want it too
using data from the worksheet. The problem is if they file name has
been used before, which it shouldnt have but could have accidently been
saved, it asks if you would like to save over this. if you click no
then it crashes.

Is it possible to set it that if u click no it just ends the macro.

thanks

Sub SAVEAS_NEW_FNE()
Dim FN As Workbook
Dim D As Variant
[D] = Format(Range("B3"), "mm_dd_yyyy")
ThisWorkbook.SaveAs Filename:="FNE " & [D]
End Sub


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:

http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538749



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping error


in a macro i have i open a 2nd workbook. when i try and get the macro
to close the file it asks to save yes/no

is there a way to stop it asking this question

Thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile: http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538749

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Stopping error

Use

Use the SaveChanges:=False option on the close.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"XCESIV" wrote in
message ...

in a macro i have i open a 2nd workbook. when i try and get the macro
to close the file it asks to save yes/no

is there a way to stop it asking this question

Thanks


--
XCESIV
------------------------------------------------------------------------
XCESIV's Profile:

http://www.excelforum.com/member.php...o&userid=24271
View this thread: http://www.excelforum.com/showthread...hreadid=538749





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
Stopping a formula Roachy Excel Discussion (Misc queries) 3 July 1st 08 03:31 PM
Stopping error messages from popping up - part 2 phil-rge-ee Excel Programming 2 April 12th 06 08:10 PM
Ms-Query stopping Steve M[_13_] Excel Programming 1 March 20th 06 02:45 PM
stopping at text.... nelg[_6_] Excel Programming 2 December 22nd 05 03:49 AM
Stopping the use of enableevents Steven Revell[_3_] Excel Programming 3 November 21st 03 07:16 AM


All times are GMT +1. The time now is 02:05 PM.

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

About Us

"It's about Microsoft Excel"