#1   Report Post  
Posted to microsoft.public.excel.programming
a a is offline
external usenet poster
 
Posts: 51
Default Help!!!

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help!!!

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.

--
Regards,
Tom Ogilvy


"a" wrote in message
et...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
a a is offline
external usenet poster
 
Posts: 51
Default Thank you Tog Ogilvy!!!!!!!

Such a small thing and it has been driving me crazy. Thank you again,
Tom Ogilvy!

Tom Ogilvy wrote:

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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"