Тёмный

Excel Macro and VBA Extract the filename of a file in a Folder 

InIT Learning
Подписаться 2,7 тыс.
Просмотров 18 тыс.
50% 1

This video shows you how to find the file name of a file in a specified folder and then use that file name along with the file path in your Macro. This helps when you have created a Macro that refers to a filename but then people keep sending you the data but with different file names. This makes your macro more dynamic by allocating the file name and path to Variables in your VBA code.
SAMPLE:
Sub GetFileName()
'This will get the name of the first file in the folder
'David Ludlow InIT Learning
'One-day Excel Courses
'www.initlearni...
Dim FileName As String
Dim PathName As String
Dim FullFileName As String
'Enter your File Path
PathName = "C:\YOURFILEPATH\"
FileName = Dir(PathName & "*.*")
FullFileName = PathName & FileName
MsgBox (FullFileName)
End Sub

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 8   
@MohAboAbdo
@MohAboAbdo 2 года назад
Thank you so mutch.
@InITLearning
@InITLearning 2 года назад
You're welcome!
@OneDayIllReview
@OneDayIllReview 9 месяцев назад
I want to create a macro where it extracts multiple file paths within a folder as hyperlinks - any way to do this?
@shoaibch1234
@shoaibch1234 2 года назад
Wonderful. If i have a file name for example "data_date_time" date can be 22_2_2022 and time can be 18_00 is it possible to use the wild card only for one specific part of the file name
@MartinezRBA
@MartinezRBA Год назад
Wonderful!! It's helping me to learn VBA code, thank you very much for the information
@InITLearning
@InITLearning 6 месяцев назад
You’re very welcome
@manfly3614
@manfly3614 3 года назад
Super useful for a beginner like me. Thanks a lot!!
@InITLearning
@InITLearning 3 года назад
Glad it was helpful!
Далее
Excel VBA | Export List of File Names from Folder
11:55
Meni yerga urdingda
00:20
Просмотров 487 тыс.
Barno
00:22
Просмотров 658 тыс.
VBA to BROWSE & COPY Data from SELECTED File in Excel
10:00
How to Use the File System Object in VBA
25:42
Просмотров 9 тыс.
Meni yerga urdingda
00:20
Просмотров 487 тыс.