View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
taylorm[_3_] taylorm[_3_] is offline
external usenet poster
 
Posts: 1
Default Question on SaveCopyAs


No, the filenames are different. The file being written out will have
name such as FCST_Mar-2408.xls and it's being written to a completel
different directory where the template file name is Forecast.xls.
(I've used the word "template" rather loosely, it's actually an xl
file, not an xlt.)

Here's the code to the last part of the macro where we're Saving th
Copy As and then re-opening the original file. We've commented out th
UNC address and replaced it with the fully qualified drive mapped pat
from a named range "TemplateDir", which we pickup by using th
cell("filename") function on the active sheet.

' Save file to destination directory, open original template
strDirPath = ActiveSheet.Range("DirectoryPath").Value
strFileName = ActiveSheet.Range("Category").Value
strBC = ActiveSheet.Range("Entity").Value
strFullName = strDirPath & "\" & strFileName & "-" & strBC
".xls"
ActiveWorkbook.SaveCopyAs FileName:=strFullName
Response = MsgBox("File has been copied to " & strFullName
vbOKOnly)
Application.DisplayAlerts = False
' Workbooks.Ope
FileName:="\\FNFNSH42\VOL1\MCAPPL\Hypprod5.5\Exp\W orkbook\Process\2006\Forecast\Forecast.xls"
Workbooks.Open FileName:=ActiveSheet.Range("TemplateDir").Value
"Forecast.xls"
Application.DisplayAlerts = Tru

--
taylor
-----------------------------------------------------------------------
taylorm's Profile: http://www.excelforum.com/member.php...fo&userid=2889
View this thread: http://www.excelforum.com/showthread.php?threadid=52499