python运行excel的VBA代码
import os, os.path
import win32com.client
    
if os.path.exists("ceshi.xlsm"):
    xl=win32com.client.Dispatch("Excel.Application")
    wb = xl.Workbooks.Open(os.path.abspath("ceshi.xlsm"), ReadOnly=1) #打开excel文件,只读模式
    xl.Application.Run("ceshi.xlsm!Module1.ceshi") #运行VBA代码
    wb.Close(False) #close the work sheet object rather than quitting excel
    del wb
    del xl
python运行excel的VBA代码;非常简单。
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号