Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey all,
I can set a filename with sFileName = Application.GetOpenFilename Is there a similar way to set the path as a variable? Currently I am using a command: Set oDoc = oAPP.OpenDataDoc("C:\January\File.xls") with a bunch of editting to File.xls I would like to change this to Set oDoc = oAPP.OpenDataDoc(strPATH + "File.xls") where I have opened some sort of dialog to set the Path for the current month. Thanks in advance, Lance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I got this code from this newsgroup, just sharing, ;)
'======= 'Your sub here sNewItem = InputBox(prompt:="Enter Entire Path for Folder Location!") On Error Resume Next Set oFSO = CreateObject("Scripting.FileSystemObject") Set Folder = oFSO.GetFolder(sNewItem) '"M:\Qadocs\IPI'S\Test Folder" 'do more code here '====== This snippet from the above code, "M:\Qadocs\IPI'S\Test Folder" is a default value, change it to whatever you may need. HTH -- Regards VBA.Noob.Confused XP Pro Office 2007 "Lance Hoffmeyer" wrote: Hey all, I can set a filename with sFileName = Application.GetOpenFilename Is there a similar way to set the path as a variable? Currently I am using a command: Set oDoc = oAPP.OpenDataDoc("C:\January\File.xls") with a bunch of editting to File.xls I would like to change this to Set oDoc = oAPP.OpenDataDoc(strPATH + "File.xls") where I have opened some sort of dialog to set the Path for the current month. Thanks in advance, Lance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The snippet I quoted is actually "rem" out, so do not use that protion.
-- Regards VBA.Noob.Confused XP Pro Office 2007 "Rick S." wrote: I got this code from this newsgroup, just sharing, ;) '======= 'Your sub here sNewItem = InputBox(prompt:="Enter Entire Path for Folder Location!") On Error Resume Next Set oFSO = CreateObject("Scripting.FileSystemObject") Set Folder = oFSO.GetFolder(sNewItem) '"M:\Qadocs\IPI'S\Test Folder" 'do more code here '====== This snippet from the above code, "M:\Qadocs\IPI'S\Test Folder" is a default value, change it to whatever you may need. HTH -- Regards VBA.Noob.Confused XP Pro Office 2007 "Lance Hoffmeyer" wrote: Hey all, I can set a filename with sFileName = Application.GetOpenFilename Is there a similar way to set the path as a variable? Currently I am using a command: Set oDoc = oAPP.OpenDataDoc("C:\January\File.xls") with a bunch of editting to File.xls I would like to change this to Set oDoc = oAPP.OpenDataDoc(strPATH + "File.xls") where I have opened some sort of dialog to set the Path for the current month. Thanks in advance, Lance |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() GetOpenFileName returns the path and the file name. I have never seen your particular Open method used in Excel. If oApp is an Excel application object then this might be more appropriate... vFileName = oApp.GetOpenFilename() If vFileName < False Then oApp.Workbooks.Open vFileName -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Lance Hoffmeyer" wrote in message Hey all, I can set a filename with sFileName = Application.GetOpenFilename Is there a similar way to set the path as a variable? Currently I am using a command: Set oDoc = oAPP.OpenDataDoc("C:\January\File.xls") with a bunch of editting to File.xls I would like to change this to Set oDoc = oAPP.OpenDataDoc(strPATH + "File.xls") where I have opened some sort of dialog to set the Path for the current month. Thanks in advance, Lance |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The oApp is for SPSS.
Jim Cone wrote: GetOpenFileName returns the path and the file name. I have never seen your particular Open method used in Excel. If oApp is an Excel application object then this might be more appropriate... vFileName = oApp.GetOpenFilename() If vFileName < False Then oApp.Workbooks.Open vFileName |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
specify default path in dialog open box | Excel Programming | |||
dialog box to pick path & file | Excel Programming | |||
open dialog box for file path | Excel Programming | |||
GetOpenFilename Dialog default path | Excel Programming | |||
Getting the full path when from a File Open Dialog Box | Excel Programming |