WingSystems
New Member
- Joined
- Aug 24, 2016
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
All -
Beginning coder attempting to write macro to attach to a CommandButton to store a selected file path (folder or file from MS File Explorer) into a specific cell "B2".
Currently having issues with the code below:
Issues:
Thank you!
Beginning coder attempting to write macro to attach to a CommandButton to store a selected file path (folder or file from MS File Explorer) into a specific cell "B2".
Currently having issues with the code below:
Code:
Sub GetFilePath2()
Dim filename As String
filename = Application.GetOpenFilename
Dim cell As Range
cell = Application.Range("B2")
cell.Value = filename
End Sub
Issues:
- The Open File Explorer pops up but does not allow you to select a folder, rather must "open" a file. Is there a different application than ".GetOpenFilename" I should be using?
- Getting run-time error "'91': Object variable or With block variable not set"
Thank you!
Last edited: