Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
Hi,
I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
Your code (which works) results in myFileName containing something like:
C:\Temp\Inside\whatever.xls a string with the full path and file name. You can get the individual parts by splitting the string on the last backslash. -- Gary's Student "Jeff" wrote: Hi, I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
Hi Jeff,
Try this method (it works only in XL2003): Sub test() With Application.FileDialog(msoFileDialogFolderPicker) If .Show = 0 Then y = "" Else y = .SelectedItems(1) End If End With End Sub Regards, Stefi €˛Jeff€¯ ezt Ć*rta: Hi, I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
The problem I was having was if there was a folder with no files in it.
My first step was to create a new folder and then populate it, but it is a problem here because there are no files there yet. Any suggestions? "Gary''s Student" wrote: Your code (which works) results in myFileName containing something like: C:\Temp\Inside\whatever.xls a string with the full path and file name. You can get the individual parts by splitting the string on the last backslash. -- Gary's Student "Jeff" wrote: Hi, I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
Hi Jeff,
Try this method: Sub test() With Application.FileDialog(msoFileDialogFolderPicker) If .Show = 0 Then y = "" Else y = .SelectedItems(1) End If End With End Sub Regards, Stefi €˛Jeff€¯ ezt Ć*rta: Hi, I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
Unfortunately, I am using excel 97, so that method doesn't work.
But thanks for your help! "Stefi" wrote: Hi Jeff, Try this method: Sub test() With Application.FileDialog(msoFileDialogFolderPicker) If .Show = 0 Then y = "" Else y = .SelectedItems(1) End If End With End Sub Regards, Stefi €˛Jeff€¯ ezt Ć*rta: Hi, I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change directory
Jim Rech has a BrowseForFolder routine at:
http://www.oaltd.co.uk/MVP/Default.htm (look for BrowseForFolder) John Walkenbach has one at: http://j-walk.com/ss/excel/tips/tip29.htm Jeff wrote: Hi, I was using the ChDir = "C:\Temp" to change the directory Is there anyway to specify the directory, and then save the path as a string. I was trying. myFileName = Application.GetOpenFilename("Excel Files, *.xls") y = Dir(myFileName, vbDirectory) but y was just set to the filename, I wanted the path like "C:\Temp" Thanks for your help! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Want cell ref. to change after sort in other sheet | Excel Discussion (Misc queries) | |||
How can I change list into a directory format? | Excel Worksheet Functions | |||
Formula Link References Change to Startup Directory | Links and Linking in Excel | |||
Takes too long for Filedialog to change directory | Excel Discussion (Misc queries) | |||
change directory for refresh data | Excel Discussion (Misc queries) |