BLACK FRIDAY SALE 20% OFF ALL COURSES

mreevies
Member
Members

Forum Posts: 6
Member Since:
June 25, 2016
June 25, 2016

Hi, I have created a macro that steps through folders and opens each individual workbook runs a standard macro in that workbook closes the file and moves onto the next file until all have been done.
I have used Application.Run (File.Name & "!UpdatePeriod") to call and run the macro, where UpdatePeriod is the macro name in each workbook. The issue I have is that if the filename may contain spaces or characters like (&-) and then the macro stops saying that it cannot access the macro. At the end of the macro I am resaving the file with a different name including the current period. Are there any guidelines or rules that I should be following in terms of naming conventions so that opening the file and running the macro is not an issue?
I have used Application.Run (File.Name & "!UpdatePeriod") to call and run the macro, where UpdatePeriod is the macro name in each workbook. The issue I have is that if the filename may contain spaces or characters like (&-) and then the macro stops saying that it cannot access the macro. At the end of the macro I am resaving the file with a different name including the current period. Are there any guidelines or rules that I should be following in terms of naming conventions so that opening the file and running the macro is not an issue?
Many thanks in advance.

Philip Treacy
Admin

Forum Posts: 1563
Member Since:
October 5, 2010
October 5, 2010

Hi,
If you have posted this qs on another forum please let us know so we aren't duplicating effort.
As the answer on the other forum said, wrap your call in quotes
Application.Run ("'" & File.Name & "'!UpdatePeriod" Or don't use spaces in filenames. As a programmer I hate having to deal with spaces in filenames, URL's etc. Phil
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Timothy, Velouria, Sean O'Hagan, Jill Niemeier, Bright Asamoah, Pam Baillie, Todd Heckman
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1864
SunnyKow: 1432
Anders Sehlstedt: 886
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 241
Hans Hallebeek: 227
Jessica Stewart: 219
A.Maurizio: 213
Newest Members:
Kelvin H
Anya Ledwith
Mark Melvin
Stuart McInnes
Naji Moukhachen
Robert Mason
Debora Cohen
Kris Whitaker
Rajesh Jawajala
Todd Heckman
Forum Stats:
Groups: 3
Forums: 24
Topics: 6641
Posts: 29140
Member Stats:
Guest Posters: 49
Members: 33096
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —
