ActiveWorkbook.Path
Hi,
You can use .Path for this. Hope this helps;
Code:ActiveWorkbook.Path
Dim sFile1 As Variant
sFile1 = Application.GetOpenFilename
Msgbox sFile1
Hi,
Do me a favour, run your code with this line added at the end;
Code:Dim sFile1 As Variant sFile1 = Application.GetOpenFilename Msgbox sFile1
It does provide the full path....
Function FolderPart(sPath As String) As String
FolderPart = Left(sPath, InStrRev(sPath, "\"))
End Function
Sub Test_GetFolder()
MsgBox GetFolder("Get My Folder", ThisWorkbook.path)
End Sub
Function GetFolder(Optional sTitle As String = "Select Folder", _
Optional sInitialFilename As String)
Dim myFolder As String
With Application.FileDialog(msoFileDialogFolderPicker)
If sInitialFilename = "" Then sInitialFilename = ThisWorkbook.path
.initialFilename = sInitialFilename
.Title = "Greetings"
If .Show = -1 Then
GetFolder = .SelectedItems(1)
If Right(GetFolder, 1) <> "\" Then
GetFolder = GetFolder & "\"
End If
Else: GetFolder = ""
End If
End With
End Function