Help!!!

A

a

I know, I'm relentless. I'm trying to narrow this down as much as possible.

I have a file with a procedure which loops through other files, adding a
module (that part works), but when I try to assign the macro - which is
in both the working file and the file in the loop, the macro that gets
assigned comes from the source file rather than the file in the loop if
I use this code:

Selection.OnAction = "Benefits"

If I assign a variable to the file in the loop - in this case it's "test
4516.xls" and use the following code, I error out:

Selection.OnAction = fileWextention & "!Benefits"

If I use the following code to (which refers to the source file), the
code will work and assign the macro but to the source file and not the
file I'm trying to update:

Selection.OnAction = "AddingModule2.xls!Benefits"

Can anybody tell me what I'm doing wrong?????

thanks much in advance,
Anita
 
T

Tom Ogilvy

Selection.OnAction = "'" & fileWextention & "'!Benefits"

since the file in questions has a space in the name, enclose the name in
single quotes for the assignment as shown.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top