Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening File Browser
I would like to open a normal Folder (Not a file) in VBA
for browsing files from a path contructed from an array. If I put path in a cell as a hyperlink I can click on it and the folder will open. If I try to open the folder fron a macro I get errors. I've tried: Worksheets("SheetName").Range("A2").Hyperlink.Foll ow NewWindow:=True I get: Object doesn't support this property or method What I am trying to do, is allow a user to open a folder based on a subject, direct them to the appropriate folder that contains files pertaining to the subject and allow them to choose the document they wish. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening File Browser
I think the usual way of doing this is to change to the desired drive and
folder and then use GetOpenFilename: Sub a() Dim FName As Variant ChDrive "D" ChDir "\download" FName = Application.GetOpenFilename("Excel files (*.xls),*.xls") If FName < False Then Workbooks.Open FName End Sub You'd have to take the path info and put it into the first two lines above. -- Jim Rech Excel MVP "Stoodwalk" wrote in message ... |I would like to open a normal Folder (Not a file) in VBA | for browsing files from a path contructed from an array. | If I put path in a cell as a hyperlink I can click on it | and the folder will open. If I try to open the folder fron | a macro I get errors. | | I've tried: | Worksheets("SheetName").Range("A2").Hyperlink.Foll ow | NewWindow:=True | | I get: | Object doesn't support this property or method | | What I am trying to do, is allow a user to open a folder | based on a subject, direct them to the appropriate folder | that contains files pertaining to the subject and allow | them to choose the document they wish. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening File Browser
I do not want to open a file, I want to open a folder so
that a user may select a .pdf file or a word doc or whatever. The content will vary from subject to subject I just want to open a browser window at the desired path. A dialog box will close as soon as you select a file, I want a browser so it can stay open. I do apologize for the confusion. Thank you for your answer I do apreciate it. -----Original Message----- I think the usual way of doing this is to change to the desired drive and folder and then use GetOpenFilename: Sub a() Dim FName As Variant ChDrive "D" ChDir "\download" FName = Application.GetOpenFilename("Excel files (*.xls),*.xls") If FName < False Then Workbooks.Open FName End Sub You'd have to take the path info and put it into the first two lines above. -- Jim Rech Excel MVP "Stoodwalk" wrote in message ... |I would like to open a normal Folder (Not a file) in VBA | for browsing files from a path contructed from an array. | If I put path in a cell as a hyperlink I can click on it | and the folder will open. If I try to open the folder fron | a macro I get errors. | | I've tried: | Worksheets("SheetName").Range("A2").Hyperlink.Foll ow | NewWindow:=True | | I get: | Object doesn't support this property or method | | What I am trying to do, is allow a user to open a folder | based on a subject, direct them to the appropriate folder | that contains files pertaining to the subject and allow | them to choose the document they wish. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening File Browser
I do not want to open a file
My code opened the file as an example of using what the user selected. You don't have to open. Also you can put any file spec in the macro, PDF, etc. I just want to open a browser window at the desired path. What is a "browser window"? Where in Excel did you see one if it's not the File, Open dialog? What's the full scenario - the dialog opens, the user clicks a file, then what? -- Jim Rech Excel MVP "Stoodwalk" wrote in message ... |I do not want to open a file, I want to open a folder so | that a user may select a .pdf file or a word doc or | whatever. The content will vary from subject to subject I | just want to open a browser window at the desired path. A | dialog box will close as soon as you select a file, I want | a browser so it can stay open. | | I do apologize for the confusion. | Thank you for your answer I do apreciate it. | -----Original Message----- | I think the usual way of doing this is to change to the | desired drive and | folder and then use GetOpenFilename: | | Sub a() | Dim FName As Variant | ChDrive "D" | ChDir "\download" | FName = Application.GetOpenFilename("Excel files | (*.xls),*.xls") | If FName < False Then Workbooks.Open FName | End Sub | | You'd have to take the path info and put it into the | first two lines above. | -- | Jim Rech | Excel MVP | | "Stoodwalk" wrote | in message | ... | |I would like to open a normal Folder (Not a file) in VBA | | for browsing files from a path contructed from an array. | | If I put path in a cell as a hyperlink I can click on it | | and the folder will open. If I try to open the folder | fron | | a macro I get errors. | | | | I've tried: | | Worksheets("SheetName").Range("A2").Hyperlink.Foll ow | | NewWindow:=True | | | | I get: | | Object doesn't support this property or method | | | | What I am trying to do, is allow a user to open a folder | | based on a subject, direct them to the appropriate | folder | | that contains files pertaining to the subject and allow | | them to choose the document they wish. | | | . | |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening File Browser
Jim, thanks for rechecking this post.
I may be using the term browser a little too loosely. I think I mean Windows Explorer or Explorer.exe. The spreadsheet has a list of products across the top, and rows that describe options. The "files" are in several formats a cover a range of subjects, much of it is test data and reports. The users wish to open the folder and peruse the contents and will most likely open several documents but don't want to repeatedly open a dialog box to open more documents. I thought it would easier if they could just open the folder that contained the files that are on the network. -----Original Message----- I do not want to open a file My code opened the file as an example of using what the user selected. You don't have to open. Also you can put any file spec in the macro, PDF, etc. I just want to open a browser window at the desired path. What is a "browser window"? Where in Excel did you see one if it's not the File, Open dialog? What's the full scenario - the dialog opens, the user clicks a file, then what? -- Jim Rech Excel MVP "Stoodwalk" wrote in message ... |I do not want to open a file, I want to open a folder so | that a user may select a .pdf file or a word doc or | whatever. The content will vary from subject to subject I | just want to open a browser window at the desired path. A | dialog box will close as soon as you select a file, I want | a browser so it can stay open. | | I do apologize for the confusion. | Thank you for your answer I do apreciate it. | -----Original Message----- | I think the usual way of doing this is to change to the | desired drive and | folder and then use GetOpenFilename: | | Sub a() | Dim FName As Variant | ChDrive "D" | ChDir "\download" | FName = Application.GetOpenFilename("Excel files | (*.xls),*.xls") | If FName < False Then Workbooks.Open FName | End Sub | | You'd have to take the path info and put it into the | first two lines above. | -- | Jim Rech | Excel MVP | | "Stoodwalk" wrote | in message | ... | |I would like to open a normal Folder (Not a file) in VBA | | for browsing files from a path contructed from an array. | | If I put path in a cell as a hyperlink I can click on it | | and the folder will open. If I try to open the folder | fron | | a macro I get errors. | | | | I've tried: | | Worksheets("SheetName").Range("A2").Hyperlink.Foll ow | | NewWindow:=True | | | | I get: | | Object doesn't support this property or method | | | | What I am trying to do, is allow a user to open a folder | | based on a subject, direct them to the appropriate | folder | | that contains files pertaining to the subject and allow | | them to choose the document they wish. | | | . | . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening File Browser
So I'm now thinking that your real question is: Hold do I open Windows
Explorer to a specific folder? This may help if so: Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Sub LaunchWinExplorer() Dim TargetFolder As String TargetFolder = "d:\download" ShellExecute 0, "Open", TargetFolder, "", "C:\", 1 End Sub -- Jim Rech Excel MVP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Workbooks opening in browser window | Excel Discussion (Misc queries) | |||
Error opening a CSV from Web Browser after changing Region | Excel Discussion (Misc queries) | |||
HTML HREF Opening in Browser | Excel Programming | |||
Opening browser window | Excel Programming | |||
runtime error 1004 when opening excel file via VBA in a browser | Excel Programming |