Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #108380

Re: Question about ActiveWorkbook.SaveAs()

From Claus Busch <claus_busch@t-online.de>
Newsgroups microsoft.public.excel.programming
Subject Re: Question about ActiveWorkbook.SaveAs()
Date 2015-12-24 11:30 +0100
Organization A noiseless patient Spider
Message-ID <n5ghbk$1db$1@dont-email.me> (permalink)
References <4NqdnS91_pj5LebLnZ2dnUVZ5radnZ2d@giganews.com>

Show all headers | View raw


Hi Robert,

Am Thu, 24 Dec 2015 01:44:18 -0700 schrieb Robert Crandal:

> Is there a way to determine whether the user selected
> "Yes" or "No" to replace the file?

you could determine to replace always with 
Application.DisplayAlerts=False
e.g.:

Dim j As Integer
Const mypath = "C:\data\"

Application.DisplayAlerts = False
For j = 1 To 3
   ActiveWorkbook.SaveAs Filename:=mypath & "myfile" & j & ".xlsm", _
      FileFormat:=xlOpenXMLWorkbookMacroEnabled
Next ' j
Application.DisplayAlerts = True

You also could create an addition to the name if the direction exists:
Dim j As Integer
Dim extra As String
Const mypath = "C:\data\"

For j = 1 To 3
    extra = IIf(Dir(mypath & "myfile" & j & ".xlsm") <> "", "New", "")
   ActiveWorkbook.SaveAs Filename:=mypath & "myfile" & j & extra &
".xlsm", _
      FileFormat:=xlOpenXMLWorkbookMacroEnabled
Next ' j

If the saving is already done you could open the file and check the
creation data. if it is older as expected the user selected "no":

Dim j As Integer
Const mypath = "C:\data\"

Workbooks.Open mypath & "myfile1.xlsm"
MsgBox "Creation Date: " & ActiveWorkbook.BuiltinDocumentProperties(11)


Regards
Claus B.
-- 
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question about ActiveWorkbook.SaveAs() "Robert Crandal" <noreply2me@yahoo.com> - 2015-12-24 01:44 -0700
  Re: Question about ActiveWorkbook.SaveAs() Claus Busch <claus_busch@t-online.de> - 2015-12-24 11:30 +0100
  Re: Question about ActiveWorkbook.SaveAs() GS <gs@v.invalid> - 2015-12-24 13:22 -0500
    Re: Question about ActiveWorkbook.SaveAs() GS <gs@v.invalid> - 2015-12-24 13:42 -0500
      Re: Question about ActiveWorkbook.SaveAs() "Robert Crandal" <noreply2me@yahoo.com> - 2015-12-26 02:55 -0700

csiph-web