If not specified, "Open" is displayed for an Open dialog box and "Save As" is displayed for a Save As dialog box.
GetFileBox(File description|File type Another file type|2nd File description|File type, Title of dialog box, Find or Save, Default file name or full path of default file if no default folder is specified or *.* for all files,, Default folder) Title If there are multiple extensions allowed with the one type of description separate the extensions with a semi-colon. The filter is text that alternates between text that describes the filter type and the extension filter.īetween each description and extension type is a | symbol. It returns the selected filename and its full path, or an empty string if the user chooses Cancel. The GetFileBox function by itself does not open or save a file it only returns a string corresponding to the selected file. It is compact but you can only select single files.ĬorelScriptTools.GetFileBox((, _
Here is a 64 bit version FileBrowser64Bit.basĬorelDraw has a very good File Browser written in CorelScript, GetFileBox, but it still works in VBA. Its dialog box is the same as that used by windows.
There is also instructions on how to reference FOLDER_SELECTION and some options. With your own VBA code you can now examine and manipulate the contents of this folder or file.Īt the end of the Folders code there is a sample program called TEST_DIALOG. When you run your VBA code a dialog box showing your computer's directory structure will appear.Īfter you have selected a folder or file your code strDESTINATION will contain the full path and name of the folder you selected. The variable strDESTINATION can be renamed to anything you like. The reference to FOLDER_SELECTION depends on the application and where the module Folders is located relative to your code calling the function FOLDER_SELECTION. bas file for your system and import the bas file into CorelDraw, Photo-Paint, Excel, Word, Access, Publisher or PowerPoint. I have modified their version to suit a 64 bit system.ĭownload the.
The 32 bit version is by Jim Rech, Ken Getz and Michael Kaplan.
You cannot unfortunately double click on a file or folder to accept. They create a VBA version of Windows Explorer. You have the option to show the files as well. Here is some API based code, 32 bit Folders32Bit.bas and a 64 bit version Folders64Bit.bas that will display a directory structure of your computer. You the use the path to open the file or path. Instead the code outputs the full path to the file/s or folder. Using a graphical user interface to select a file or folder does not open the file or folder. I do not understand these, but standing on the shoulders of others you can use API commands. Set objFOLDER = Nothing Selecting Folders or Files VBA does not have an easy way of graphically selecting folders or files with a mouse. 'Now reset the memory allocated to every variable defined earlier with the command "Set". ObjFILE.Name = Replace(objFILE.Name, "_", " ") 'Note that it does not search any folders within the folder. If it does replace all the undercore characters. Set objMAIN_FOLDER = objFOLDER.GetFolder("C:\documents and settings\\Desktop\") 'Notice that there is no back-slash at the end of the folder path. 'Insert your details in the locations marked with.
Set objFOLDER = Interaction.CreateObject("Scripting.FileSystemObject") Here is some code that replaces all of the under-scores with spaces in all file names within a named folder on your desktop.
It should be self explanatory although complex. You can select all and copy it into your VBA code. Either right button the bas file and select "Save Target As." and then import the bas file into your VBA code.Īlternatively select the bas file with the left button of your mouse and open the bas file. When you want VBA to read file names, change file names, change file extensions, count files, change file attributes such as read only then you must use an antiquated part of VBA that relies on a script command. Saving VBA Code to a Previous Version of CorelDraw CorelDraw & VBA - Miscellaneous VBA CorelDraw & VBA