Forum Discussion

Nemmi69's avatar
Nemmi69
Copper Contributor
Jan 19, 2026

msoFileDialogFolderPicker compiler error

I have searched the net and not seen this issue.

 

I developed a stand alone program in Excel Vba using msoFileDialogFolderPicker. It runs no problem. The function is as follows:

Function PickFolder() As String
    With Application.FileDialog(msoFileDialogFolderPicker)
        If .Show = -1 Then PickFolder = .SelectedItems(1)
    End With
End Function

This was then added to a larger program with exactly the same code on the same PC and I get 'compile error' variable not found with  'msoFileDialogFolderPicker' highlighted.



1 Reply

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor

    Click Tools, References and make sure these are checked (at least these):

     

Resources