Browse naar map

Status
Niet open voor verdere reacties.

0backslash0

Gebruiker
Lid geworden
3 jul 2007
Berichten
31
Kan iemand me zeggen hoe je in vba voor outlook een inputbox kan weergeven met een
browse knop?

De string die hierdoor wordt geretourneerd zou ik dan willen gebruiken als argument om
nieuwe mappen aan te maken.

dus iets zoals dit:
Code:
root = "path"
subfolder = prompt("wat is de map?", browse)
mkdir root & "/" & subfolder
 
Code:
on error resume next
mkdir msgbox "Welke map aanmaken ?"
 
Beste,

Graag had ik een dialoogbox gemaakt waar je op een browse knop kunt drukken om de desbetreffende map te selecteren, in plaats van het volledige pad te moeten typen.

Bovenstaande code geeft enkel een dialoogvenster weer met de opgegeven text, en ok & cancel knoppen.
 
Kijk in bij de VBEditor van Outlook naar dialogs.
 
ok, ik heb de help voor VBeditor wat doorzocht op dialog en ben op het FileDialog object gestuit.
Ik heb de code overgenomen die in het voorbeeld staat, maar bij uitvoering krijg ik een
run-time error 438: object doesn't support this property or method.

code:
Code:
Sub Main()

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

    '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 and return the user's action.
        'The user pressed the action button.
        If .Show = -1 Then

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

                'vrtSelectedItem is a String that contains the path of each selected item.
                'You can use any file I/O functions that you want to work with this 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

Edit:
*De references in VBEditor:
*Visual Basic for Applications
*Microsoft Office 11.0 Object Library
*OLE Automation
*Microsoft Outlook 11.0 Object Library
*Microsoft DAO 3.6 Object Library
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan