View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default 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