[英]How to run a vba macro for multiple excel files
I am a naive user of VBA and I am looking for a VBA macro which would do the following task 我是VBA的天真的用户,并且我正在寻找可以执行以下任务的VBA宏
I tried the code available on this link Run same excel macro on multiple excel files 我尝试了此链接上可用的代码在多个Excel文件上运行相同的Excel宏
At the line Filename=Dir(Pathname & "*.xlsx")
, I am getting an error which says run time error "52" Bad file name or number
. 在
Filename=Dir(Pathname & "*.xlsx")
,我收到一条错误,指出run time error "52" Bad file name or number
。
I have changed this: 我改变了这个:
Pathname = "\C:\Users\Desktop\test\try\"\
Is this correct? 这个对吗?
Not sure if it's your only problem, but 不知道这是否是您唯一的问题,但是
\\C:\\Users\\Desktop\\test\\try\\
should be 应该
C:\\Users\\Desktop\\test\\try\\
(without the first backslash) C:\\Users\\Desktop\\test\\try\\
(不带第一个反斜杠)
*I realize this should be a comment--I'm under 50 rep, however. *我意识到这应该是一条评论-但是,我的代表不到50岁。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.