Hi,
I'm using Codeunit 412 Common Dialog Management to prompt the user for a file. My question is can you set the OpenFile function to popup the window in a specific folder via code? You can give it a default filename, but can't see how to set a default folder.
If not is there a workaround, maybe another function to call first to set the users' default folder?
Any help appreciated,
Jonathan
0
Answers
CommonDialogControl.InitDir := DefaultFileName;
I guess it takes the path of the file you pass as a parameter.
Either pass your parameter differently or
copy the function as OpenFile2, add a parameter defDir and change the line to :
CommonDialogControl.InitDir := defDir;
Try it to see if it works...
Thanks for the reply but already tried that. It simply uses the parameter as a default filename, not folder, and if you specify a backslash e.g. 'C:\WINDOWS\' then you get an error message.
Jonathan
I Copied OpenFile to new function OpenFile2.
I added one more parameter defdir (text 30);
I found the line: and changed it to:
Then to call the function I do the following:
Did you try it like this? When I run it it opens folder C:\program files\adobe with a blank filename.
Thanks for your help,
Jonathan
I tried it and it also works if you pass as a filename 'file.txt' for example, along with the path parameter...