Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default saving to two folders by selecting one

Hi, I have this code that lists some things and then it saves it in a
user selected folder, and I want to save to the selected folder and
the folder above it. Also, I want after it lists the things it lists
then it rights the name of the "selected" folder you save it in, but
not the folder above it.




Sub fill_file_names()
Dim user_pick As String
Dim r As Integer

Application.DisplayAlerts = False
Workbooks.Add
Range("1:1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("1:1").Select
user_pick = PickFolder("C:\") +
"\*detail*.wk4"
r = 1
next_file = Dir(user_pick)

Do Until next_file = ""
Sheets("Sheet1").Select
Sheets("sheet1").Cells(r, 1) = next_file
next_file = Dir()
r = r + 1
Loop

ActiveWorkbook.SaveAs Filename:="tran.wk4",
FileFormat:=xlWK4, _
CreateBackup:=False
ActiveWorkbook.Save
ActiveWorkbook.Close

Application.DisplayAlerts = True
End Sub

Function PickFolder(strStartDir As Variant) As String
Application.DisplayAlerts = False
Dim SA As Object, f As Object
Set SA = CreateObject("Shell.Application")
Set f = SA.BrowseForFolder(0, "Choose a folder", 0,
strStartDir)
If (Not f Is Nothing) Then
PickFolder = f.Items.Item.Path
End If
Set f = Nothing
Set SA = Nothing
End Function



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
Adding new folders for "Look In:" when selecting File - Open Big UT Fan Excel Discussion (Misc queries) 10 January 29th 10 09:50 PM
Saving Excel files to Read/Write only folders vteventrider Excel Discussion (Misc queries) 1 September 5th 07 08:31 PM
XL 07 Initializing Folders reno Excel Discussion (Misc queries) 0 April 20th 07 07:32 PM
saving to two places by selecting one (VBA) tim64[_9_] Excel Programming 10 June 17th 05 11:41 PM
Saving a Workbook: Forcing User to Rename before Saving Rollin_Again[_6_] Excel Programming 5 April 16th 04 02:54 PM


All times are GMT +1. The time now is 01:11 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"