I have got a large amount of file of .xlsm format in a folder and each file contains MACRO and I want to extract the name of each MACRO present in those files. How can I do it? Apology If I've done any mistake in asking the question. i.e This is my first question here.
input_path = str(input(r"Enter the input path: ")) #folder path where all the files (.xlsm formate)
import win32com.client as win32
import os
file_links = []
for root, dirs, files in os.walk(input_path):
for file in files:
full_file_name_link = os.path.join(input_path, file)
file_links.append(full_file_name_link)
for link in file_links:
excel = win32.gencache.EnsureDispatch("Excel.Application")
book = excel.Workbooks.Open(link)
excel.Application.Run(macro_name)
book.Save()
book.Close()
excel.Application.Quit()