Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

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
How to save same excel workbook in different folders as a back up GRAPH WITH A MACRO Excel Discussion (Misc queries) 2 October 13th 08 04:35 PM
Help with Creating folders on Save Alarmbloke Excel Discussion (Misc queries) 3 December 22nd 05 06:00 PM
Linking to folders Sidnoir Excel Discussion (Misc queries) 1 August 4th 05 06:14 PM
To create folders using VBA Sri Excel Discussion (Misc queries) 1 February 4th 05 01:13 PM
Auto open 8 workbooks in different folders, then save on close... pkley[_2_] Excel Programming 0 October 11th 04 11:37 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"