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

I'm having problems with display alerts that I'm not sure is fixable. I have
a macro that lets your choose a date from a form and then from that it takes
data from one workbook and copies it in to three other workbooks. It then
saves, closes and emails them to certain distribution lists. The problem is
that the form allows the user to potentially pick a previous month that has
already been saved and emailed. If it does then it comes up with an alert
asking the user if they want to overwrite the workbook that already exists.
But for me I would prefer to not even give the user an option. Is there a
way of writing an If statement that says:

If this alert comes up then end the sub and close the workbooks that were
opened and created without saving Else continue running.

Or just something that will basically also choose No when it ask if the user
wants to over write the existing workbook.

Otherwise I fear one day someone will choose Yes and they will send out the
previous months workbooks again.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Display alert problem

I think that this may do what you requi

Sub macro3()
fileSaveName = Application.GetSaveAsFilename
If fileSaveName < False Then
' look to see if filename has already been used
n1 = InStrRev(fileSaveName, "\")
fileShtNm = Right(fileSaveName, Len(fileSaveName) - n1)
filePath = Left(fileSaveName, n1 - 1)
Set fs = Application.FileSearch
With fs
.LookIn = filePath
.Filename = fileShtNm
If .Execute 0 Then
MsgBox "This file has already been saved."
Else
ActiveWorkbook.SaveAs Filename:=fileSaveName
End If
End With
End If
End Sub


"carl" wrote:

I'm having problems with display alerts that I'm not sure is fixable. I have
a macro that lets your choose a date from a form and then from that it takes
data from one workbook and copies it in to three other workbooks. It then
saves, closes and emails them to certain distribution lists. The problem is
that the form allows the user to potentially pick a previous month that has
already been saved and emailed. If it does then it comes up with an alert
asking the user if they want to overwrite the workbook that already exists.
But for me I would prefer to not even give the user an option. Is there a
way of writing an If statement that says:

If this alert comes up then end the sub and close the workbooks that were
opened and created without saving Else continue running.

Or just something that will basically also choose No when it ask if the user
wants to over write the existing workbook.

Otherwise I fear one day someone will choose Yes and they will send out the
previous months workbooks again.

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
Conditional Format to display text alert VSS Excel Worksheet Functions 3 June 6th 09 03:06 PM
display alert when workbook open Rajesh Excel Programming 5 December 28th 06 12:50 PM
Display Alert FrankJIN Excel Programming 4 November 10th 05 03:30 AM
Display an Alert popup. Xluser@work Excel Programming 4 August 24th 04 03:11 PM
Delete Display Alert tagged to an individual cell Lisa[_7_] Excel Programming 2 September 13th 03 03:55 PM


All times are GMT +1. The time now is 02:11 AM.

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"