Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MUST BE POSSIBLE !! ..........
....I want to use the GetOpenFile method to set a variable that is an
excel file i.e: MyAllocPathway = Application.GetOpenFilename("Excel Files (*.xls), *.xls, Add- in Files (*.xla), *.xla", 1, "Select Excel you wish to attach") this works ok Is it possible so that whenever this is actioned it opens with the contents of a specific folder? I've tried putting this infront of the above line, but itdoesn't seem to work: ChDir ("I:\Fin\Val data\OLA\OLAB figures (Weekly)\") Any help greatly appreciated, Jason |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MUST BE POSSIBLE !! ..........
You are changing the deafult directory on the I drive but are no
switching to that drive- You also don't need the brackets unless yo are assiging it to a variable. Duncan chdrive "I" chdir "I:\Fin\Val data\OLA\OLAB figures (Weekly)\ -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MUST BE POSSIBLE !! ..........
Jason,
It should work if you use ChDir prior to calling GetOpenFilename. You may need to use ChDrive to change the drive. E.g, ChDrive "I:" ChDir "I:\Fin\Val data\OLA\OLAB figures (Weekly)\" MyAllocPathway = Application.GetOpenFilename("Excel Files (*.xls), *.xls, Add- in Files (*.xla), *.xla", 1, "Select Excel you wish to attach") -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "jason" wrote in message om... ...I want to use the GetOpenFile method to set a variable that is an excel file i.e: MyAllocPathway = Application.GetOpenFilename("Excel Files (*.xls), *.xls, Add- in Files (*.xla), *.xla", 1, "Select Excel you wish to attach") this works ok Is it possible so that whenever this is actioned it opens with the contents of a specific folder? I've tried putting this infront of the above line, but itdoesn't seem to work: ChDir ("I:\Fin\Val data\OLA\OLAB figures (Weekly)\") Any help greatly appreciated, Jason |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
MUST BE POSSIBLE !! ..........
Hi Jason
Here is a example that is also using ChDrive Sub test() Dim SaveDriveDir As String, MyPath As String Dim FName As Variant SaveDriveDir = CurDir MyPath = "C:\Data" ChDrive MyPath ChDir MyPath FName = Application.GetOpenFilename(filefilter:="Excel Files, *.xls") If FName = False Then 'do nothing Else 'your code End If ChDrive SaveDriveDir ChDir SaveDriveDir End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "jason" wrote in message om... ...I want to use the GetOpenFile method to set a variable that is an excel file i.e: MyAllocPathway = Application.GetOpenFilename("Excel Files (*.xls), *.xls, Add- in Files (*.xla), *.xla", 1, "Select Excel you wish to attach") this works ok Is it possible so that whenever this is actioned it opens with the contents of a specific folder? I've tried putting this infront of the above line, but itdoesn't seem to work: ChDir ("I:\Fin\Val data\OLA\OLAB figures (Weekly)\") Any help greatly appreciated, Jason |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
MUST BE POSSIBLE !! ..........
Thanks to everybody for help
(Like the little touch of restoring initial settings at the end of your routine Ron) thanks again jason "Ron de Bruin" wrote in message ... Hi Jason Here is a example that is also using ChDrive Sub test() Dim SaveDriveDir As String, MyPath As String Dim FName As Variant SaveDriveDir = CurDir MyPath = "C:\Data" ChDrive MyPath ChDir MyPath FName = Application.GetOpenFilename(filefilter:="Excel Files, *.xls") If FName = False Then 'do nothing Else 'your code End If ChDrive SaveDriveDir ChDir SaveDriveDir End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "jason" wrote in message om... ...I want to use the GetOpenFile method to set a variable that is an excel file i.e: MyAllocPathway = Application.GetOpenFilename("Excel Files (*.xls), *.xls, Add- in Files (*.xla), *.xla", 1, "Select Excel you wish to attach") this works ok Is it possible so that whenever this is actioned it opens with the contents of a specific folder? I've tried putting this infront of the above line, but itdoesn't seem to work: ChDir ("I:\Fin\Val data\OLA\OLAB figures (Weekly)\") Any help greatly appreciated, Jason |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|