Get Folder Function help - Word to excel import
Error: Object variable or With block variable not set
I am creating a macro that allows me to import a word form document into excel. I am receiving the following error message and I am unsure of how to correct the error:
Error: Object variable or With block variable not set
This is my code:
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
oFolder = Nothing
End Function