Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function GetActiveWindow Lib "user32"
Hi everyone
When we use this Windows API, the default "Folder" (it's not really a folder) that is selected in the window that appears is the user's workstation. Is there a way to change that default value to a known folder or to a specific path so that the user does not have to click many times to reach the desired path I do not include any code, but it is all available if any one needs it. You just have to ask for it Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function GetActiveWindow Lib "user32"
Hi Jac,
You have a few options here. If you want to be able to specify the initial folder, you can automate the Shell interface to do it: Sub test() Dim sh As Object Dim fol As Object Dim fi As Object Set sh = CreateObject("Shell.Application") Set fol = sh.BrowseForFolder(Application.Hwnd, _ "Select Folder", 0, "C:\") If Not fol Is Nothing Then Set fi = fol.ParentFolder.ParseName(fol.Title) If Not fi Is Nothing Then MsgBox fi.Path Else MsgBox fol.Title End If Set fol = Nothing Else MsgBox "no folder selected" End If End Sub Alternatively, you can utilize the API using Jim Rech's Browse For Folder utility: http://bmsltd.ie/MVP/Default.htm (look for BrowseForFolder.zip under Jim Rech's name) -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Jac Tremblay wrote: Hi everyone, When we use this Windows API, the default "Folder" (it's not really a folder) that is selected in the window that appears is the user's workstation. Is there a way to change that default value to a known folder or to a specific path so that the user does not have to click many times to reach the desired path. I do not include any code, but it is all available if any one needs it. You just have to ask for it. Thank you. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function GetActiveWindow Lib "user32"
Hi Jake,
That is very interesting. I tried your code and it's rather straight forward. But how come one does not have to declare something like "Private Declare Function GetActiveWindow Lib "user32" () As Long" in the screen window code declaration section? Another question: Why, when I create a new folder, I can specify its new name only at the root? If not at the root, the folder gets automatically the name "New Folder" with no feed back. I will now check out Jim Rech's application. Thank you very much. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function GetActiveWindow Lib "user32"
Hi Jac,
Jac Tremblay wrote: That is very interesting. I tried your code and it's rather straight forward. But how come one does not have to declare something like "Private Declare Function GetActiveWindow Lib "user32" () As Long" in the screen window code declaration section? This code is automating the Shell - it is not calling API functions (such as GetActiveWindow) directly. Another question: Why, when I create a new folder, I can specify its new name only at the root? If not at the root, the folder gets automatically the name "New Folder" with no feed back. I'm not sure what you're referring to here. Keep in mind that we can't see your code unless you post it. <g -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function GetActiveWindow Lib "user32"
Hi Jake
My question and your answer were Another question: Why when I create a new folder, I can specify its new name only at th root? If not at the root, the folder gets automatically the name "Ne Folder" with no feed back I'm not sure what you're referring to here. Keep in mind that we can't se your code unless you post it. <g I now tell you that I have no more problem regarding this functionality. I can browse for a folder using the Shell Automation like you showed in your previous answer. I can create a new folder at the root or elsewhere and give it any name I want The reason why I did not include any code is that I refered to your own code published in the previous answer Thank you for providing me with this simple and easy way of browsing for a folder. It will be very useful Thanks too for your precious time Ja |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text "comparison" operator for "contains" used in an "IF" Function | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
inserting a conditional "go to" command on a excel "if" function | Excel Worksheet Functions |