Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save as to two folders
Here is my problem I have a save as command as follows: ActiveWorkbook.SaveAs _ Filename:="L:\" & JobNoTXT.Value & "\xldata\" & ComboBox1.Value & ".xl " The "xldata" is the Sub folder and has a new name in new projects whic is "Design Data" is there a way to save to the "xldata" and if that doe not exist to save to the other name "Design Data" Thanks for any help. : -- HelpM ----------------------------------------------------------------------- HelpMe's Profile: http://www.excelforum.com/member.php...nfo&userid=452 View this thread: http://www.excelforum.com/showthread.php?threadid=27224 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save as to two folders
Maybe you could just try to save and check for an error.
(I didn't test this) Option Explicit Sub testme02() Dim iCtr As Long Dim mySubFolderNames As Variant Dim myErrNumber As Long mySubFolderNames = Array("xldata", "design data") For iCtr = LBound(mySubFolderNames) To UBound(mySubFolderNames) On Error Resume Next ActiveWorkbook.SaveAs _ Filename:="L:\" & JobNoTXT.Value & "\" & _ mySubFolderNames(iCtr) & "\" & _ ComboBox1.Value & ".xls" myErrNumber = Err.Number Err.Clear On Error GoTo 0 If myErrNumber = 0 Then MsgBox "Saved to: " & ActiveWorkbook.FullName Exit For End If Next iCtr End Sub This does assume that nothing else could go wrong (drive not mapped/file already exists and is marked readonly). HelpMe wrote: Here is my problem I have a save as command as follows: ActiveWorkbook.SaveAs _ Filename:="L:\" & JobNoTXT.Value & "\xldata\" & ComboBox1.Value & ".xls " The "xldata" is the Sub folder and has a new name in new projects which is "Design Data" is there a way to save to the "xldata" and if that does not exist to save to the other name "Design Data" Thanks for any help. :) -- HelpMe ------------------------------------------------------------------------ HelpMe's Profile: http://www.excelforum.com/member.php...fo&userid=4523 View this thread: http://www.excelforum.com/showthread...hreadid=272244 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to save same excel workbook in different folders as a back up | Excel Discussion (Misc queries) | |||
Help with Creating folders on Save | Excel Discussion (Misc queries) | |||
Linking to folders | Excel Discussion (Misc queries) | |||
To create folders using VBA | Excel Discussion (Misc queries) | |||
Auto open 8 workbooks in different folders, then save on close... | Excel Programming |