Open a file open dialog in Project 
Author Message
 Open a file open dialog in Project

I post a request but the samples provided don't work.
What are the prerequisite?
My VBA environment seems properly referenced.
Do we need to initialize the object variable if yes How
do you do that

Here the 3 sample. If you copy  and paste them in the
global.mpt none of them works.
Can someone help me ?

The goal is to provide the user a window open dialog box
for Window Xp or NT users.

Thanks for you help.

Sample 1

Sub openDialog()
    Dim cdl As CommonDialog
    Set cdl = New CommonDialog
    cdl.initdir = "C:\"
    cdl.Flags = cdlOFNAllowMultiSelect Or
cdlOFNNoChangeDir
    cdl.ShowOpen
    '..............
    Set cdl = Nothing
End Sub

Sample two

Sub Macrofileop()

    'Declare a variable as a FileDialog object.
    Dim fd As FileDialog
    Dim oproj As Object

    'Create a FileDialog object as a File Picker dialog
box.
    Set fd = Application.FileDialog
(msoFileDialogFilePicker)

    'Declare a variable to contain the path
    'of each selected item. Even though the path is a
String,
    'the variable must be a Variant because For
Each...Next
    'routines only work with Variants and Objects.
    Dim vrtSelectedItem As Variant

    'Use a With...End With block to reference the
FileDialog object.
    With fd

        'Use the Show method to display the File Picker
dialog box
        'The user pressed the action button.
        If .Show = -1 Then

            'Step through the FileDialogSelectedItems
collection.
            For Each vrtSelectedItem In .SelectedItems

                'vrtSelectedItem contains the path of
each selected item.
                'Here use any file I/O functions you want
on the path.
                'This example simply displays the path in
a message box.
                MsgBox "The path is: " & vrtSelectedItem

            Next vrtSelectedItem
        'The user pressed Cancel.
        Else
        End If
    End With

    'Set the object variable to Nothing.
    Set fd = Nothing

End Sub

Sample 3
-----------------

Sub DisplayAndExecuteFileDialog(ByRef fd As FileDialog)

    'Use a With...End With block to reference the
FileDialog object.
    With fd
        'If the user presses the action button...
        If .Show = -1 Then

            'Use the DialogType property to determine
whether to
            'use the Execute method.
            Select Case .DialogType
                Case msoFileDialogOpen,
msoFileDialogSaveAs: .Execute
                'Do nothing otherwise.
                Case Else
            End Select
        'If the user presses Cancel...
        Else
        End If
    End With

End Sub



Sun, 29 May 2005 23:48:41 GMT  
 Open a file open dialog in Project
Hi,

I didn't see the sample code from the link i posted in the
other thread (maybe you missed it?).  It uses an API call
for the standard file open/save dialog box.  It works on
my WinXP machine so it should also work on WinNT as well.  
It was originally coded for Access97, but I basically had
no problems getting working for MSP2000.  Here's the link
if you're interested:

http://www.mvps.org/access/api/api0001.htm

And the references I have in MSP2000 are:
Visual Basic For Applications
Microsoft Project 9.0 Object Library
OLE Automation
Microsoft Office 9.0 Object Library
Microsoft Forms 2.0 Object Library

HTH
--Jason

Quote:
>-----Original Message-----
>I post a request but the samples provided don't work.
>What are the prerequisite?
>My vba environment seems properly referenced.
>Do we need to initialize the object variable if yes How
>do you do that

>Here the 3 sample. If you copy  and paste them in the
>global.mpt none of them works.
>Can someone help me ?

>The goal is to provide the user a window open dialog box
>for Window Xp or NT users.

>Thanks for you help.



Mon, 30 May 2005 00:05:46 GMT  
 Open a file open dialog in Project
I try what you propose
does not work

can you cut and paste the one that work for you ?

I don't understand what i do wrong ?



Mon, 30 May 2005 02:05:22 GMT  
 Open a file open dialog in Project
Could you provide more details about "does not work". Is there any error
message or anything else?

Vaso
===============================

Quote:
> I try what you propose
> does not work

> can you cut and paste the one that work for you ?

> I don't understand what i do wrong ?



Mon, 30 May 2005 04:42:41 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. opening a browse or file open dialog

2. Common Dialog's File Open dialog question

3. Editing the Open Project dialog box

4. Acc97: Specifying /CMD parameter when opening database via open dialog

5. How to just open the Open dialog box?

6. Open a Save/Open-dialog

7. Open Multiselect Open dialog box

8. Open File Dialog not showing Files

9. selecting multiple files with file open common dialog?

10. Open file dialog box and upload file

11. Opening a File Open window for file selection in VBA

12. Getting open file name w/o opening file

 

 
Powered by phpBB® Forum Software