05-27-2022
04:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-27-2022
04:01 AM
In this case I recommend you to try iLogic. It is much more powerful then VBA and IO.Path functionality is also available.
Lot of syntax is identical in VBA and iLogic. But if you want to continue using VBA, you can use FileSystemObject
Sub FileSystemObjectTest()
'With reference to 'Microsoft Scripting Runtime'
'It enables intelliSense
' Dim fs As FileSystemObject
' Set fs = New FileSystemObject
'Without reference
Set fs = CreateObject("Scripting.FileSystemObject")
Dim fileName As String
fileName = ThisApplication.ActiveDocument.FullFileName
fileFolder = fs.GetParentFolderName(fileName)
excelFile = fs.BuildPath(fileFolder, "ExcelFile.xls")
End Sub