Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OPENING MULTIPLE FILES.do commondialog has some method.i dont think so

Status
Not open for further replies.

rohitt

Programmer
Jul 1, 2002
42
IN
i have to open multiple Microsoft Project file (mpp), copy data from it and paste in another file.

so it can be done by looping through and again and again asking the user for next file..is there any way that he can select all the files needed to be copied at one once only i.e. at the starting only..just like pressing ctrl and selecting files

Do there is some property in common dialog which will let me do this, or is there some other component which will accomplish my task...plz let me know.

how how how how ? ? ? ? ? ? ? how how how how
 
if you are using the common dialog control then you should first set its .Flags property to allow selection of multiple files

from MSDN:

Flags Property (Open, Save As Dialogs)


Returns or sets the options for the Open and Save As dialog boxes.

Syntax

object.Flags [= value]

The Flags property syntax has these parts:

Part Description
object Anobject expression that evaluates to an object in the Applies To list.
value Aconstant or value specifying the options for the Open and Save As dialog boxes, as described in Settings.


Settings

The settings for value are:

Constant Value Description
cdlOFNAllowMultiselect &H200 Specifies that the File Namelist box allows multiple selections.
The user can select more than one file atrun time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files. When this is done, the FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces.
MSDN says spaces but I found out that the names are separated by vbNullChar (Chr$(0)). If the user selects multiple files then the first name would be the foldername and the rest the filenames.

cdlOFNCreatePrompt &H2000 Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the cdlOFNPathMustExist and cdlOFNFileMustExist flags.
cdlOFNExplorer &H80000 Use the Explorer-like Open A File dialog box template. Works with Windows 95, Windows NT 4.0, or later versions.
CdlOFNExtensionDifferent &H400 Indicates that the extension of the returned filename is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt property is Null, if the extensions match, or if the file has no extension. This flag value can be checked upon closing the dialog box.
cdlOFNFileMustExist &H1000 Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid filename, a warning is displayed. This flag automatically sets the cdlOFNPathMustExist flag.
cdlOFNHelpButton &H10 Causes the dialog box to display the Help button.
cdlOFNHideReadOnly &H4 Hides the Read Onlycheck box.
cdlOFNLongNames &H200000 Use long filenames.
cdlOFNNoChangeDir &H8 Forces the dialog box to set the current directory to what it was when the dialog box was opened.
CdlOFNNoDereferenceLinks &H100000 Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
cdlOFNNoLongNames &H40000 No long file names.
CdlOFNNoReadOnlyReturn &H8000 Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory.
cdlOFNNoValidate &H100 Specifies that the common dialog box allows invalid characters in the returned filename.
cdlOFNOverwritePrompt &H2 Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
cdlOFNPathMustExist &H800 Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed.
cdlOFNReadOnly &H1 Causes the Read Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read Only check box when the dialog box is closed.
cdlOFNShareAware &H4000 Specifies that sharing violation errors will be ignored.


Remarks

The cdlOFNExplorer and cdlOFNNoDereferenceLinks flags work only under Windows 95, Windows NT 4.0, or later versions. Multiselect common dialogs under Windows 95/98 using cdlOFNExplorer use null characters for delimiters.

Under both Windows NT 4.0 and Windows 95 (and later versions), if you do not choose the cdlOFNAllowMultiselect flag, then both the cdlOFNExplorer and cdlOFNLongNames flags have no effect and are essentially the default.

If you use the cdlOFNAllowMultiselect flag by itself under both Windows NT 4.0 and Windows 95 (and later versions), you will not have support for long filenames. This is because the multiple filenames come back space delimited and long filenames could include spaces. You cannot avoid this behavior if you have Windows NT 3.5. If you use cdlOFNAllowMultiselect, you cannot see long filenames. If you add the cdlOFNExplorer flag under Windows 95 or later, you will be able to both multiselect and see long filenames. But the filenames come back null character delimited and not space delimited.

These constants are listed in the Microsoft CommonDialog Control (MSComDlg)object library in the Object Browser.

You can also define selected flags. Use the Const keyword in the Declarations section of the startup form to define the flags you want to use. For example:

Const ReadOnly = &H00000001&
Const Effects = &H00000100&
CommonDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results. The following is equivalent to the preceding example:

CommonDialog1.Flags = &H210&

Data Type

Long

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top