Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Office Verzeichnis Dialog ohne Verweis auf Object Library

14.08.2019 (👁10836)

Office Verzeichnis Dialog ohne Verweis auf ObjectLibrary

Folgender vba Makro Code erstellt einen Ordner Dialog in Microsoft Office Anwendungen

Office, Word, Access, Excel, PowerPoint, Outlook

 

Dabei kann man anschliessend einen Ordner auswählen und übernehmen, ohne zusätzlich unter Verweise eine Referenz zu Microsoft Office 15.0 Object Library zu erstellen

Option Compare Database

Option Explicit On

Function fxVerzeichnis_waehlen(sPath_Start, sTitel) As String

    '----------------< Dialog-Aufruf (public) >---------------------

    ' Zeigt ein Dialogfeld Datei öffnen an. Gibt den kompletten

    ' Verzeichnispfad zurück.

    Dim sReturn As String

    '--< Import-Dialog >--

    Dim objFolderdialog As Object 'As FileDialog

    Set objFolderdialog = Application.FileDialog(4)

    'Const msoFileDialogFolderPicker = 4

    'Const msoFileDialogFilePicker = 3

    objFolderdialog.AllowMultiSelect = False

    objFolderdialog.ButtonName = "->Verzeichnis übernehmen"

    objFolderdialog.Title = "Verzeichnis auswählen.."

    objFolderdialog.InitialView = 9

    'Const msoFileDialogViewTiles = 9

    'Const msoFileDialogViewDetails = 2

    objFolderdialog.InitialFileName = sPath_Start

    objFolderdialog.AllowMultiSelect = False

    If Not objFolderdialog.Show() = True Then

        sReturn = ""

        fxVerzeichnis_waehlen = sReturn

        Exit Function

    End If

    '--< Import-Dialog >--

    '-< check >-

    '</ Ordner ist leer >

    If objFolderdialog.SelectedItems().Count = 0 Then

        sReturn = ""

    End If

    '</ Ordner ist leer >

    '-</ check >-

    sReturn = objFolderdialog.SelectedItems(1)

    'sReturn = objFolderdialog.SelectedItems.Item(1)

    '< out >

    fxVerzeichnis_waehlen = sReturn

    '</ out >

End Function