Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Multi-word WB name

Excel XP & Win XP
I have 2 workbooks open, AAA.xls & BBB.xls.
I want to run macro TestBBB, located in BBB.xls, from within AAA.xls.
The code (in AAA.xls):
Application.Run ("BBB.xls!TestBBB")
works fine (thanks to Mark Dullingham).

Now change the scenario:
Change the name of the BBB.xls WB to "BB B.xls" (insert a space in the name)
The code (in AAA.xls):
Application.Run ("BB B.xls!TestBBB")
produces an error "Macro 'BB B.xls!TestBBB' cannot be found."

My question: What is the proper syntax for the Application.Run statement
when the target workbook has a multi-word name?
Thanks for your time. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Multi-word WB name

Application.Run ("'BB B.xls'!TestBBB")


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
I have 2 workbooks open, AAA.xls & BBB.xls.
I want to run macro TestBBB, located in BBB.xls, from within AAA.xls.
The code (in AAA.xls):
Application.Run ("BBB.xls!TestBBB")
works fine (thanks to Mark Dullingham).

Now change the scenario:
Change the name of the BBB.xls WB to "BB B.xls" (insert a space in the
name)
The code (in AAA.xls):
Application.Run ("BB B.xls!TestBBB")
produces an error "Macro 'BB B.xls!TestBBB' cannot be found."

My question: What is the proper syntax for the Application.Run statement
when the target workbook has a multi-word name?
Thanks for your time. Otto



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Multi-word WB name

You need single quotes around the filename.

ie
Application.Run ("'BB B.xls'!TestBBB")

"Otto Moehrbach" wrote:

Excel XP & Win XP
I have 2 workbooks open, AAA.xls & BBB.xls.
I want to run macro TestBBB, located in BBB.xls, from within AAA.xls.
The code (in AAA.xls):
Application.Run ("BBB.xls!TestBBB")
works fine (thanks to Mark Dullingham).

Now change the scenario:
Change the name of the BBB.xls WB to "BB B.xls" (insert a space in the name)
The code (in AAA.xls):
Application.Run ("BB B.xls!TestBBB")
produces an error "Macro 'BB B.xls!TestBBB' cannot be found."

My question: What is the proper syntax for the Application.Run statement
when the target workbook has a multi-word name?
Thanks for your time. Otto



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Multi-word WB name

Hi, Otto,

Enclose the workbook name in single quotes.

Application.Run("'BB B.xls'!TestBBB")

--
Hope that helps.

Vergel Adriano


"Otto Moehrbach" wrote:

Excel XP & Win XP
I have 2 workbooks open, AAA.xls & BBB.xls.
I want to run macro TestBBB, located in BBB.xls, from within AAA.xls.
The code (in AAA.xls):
Application.Run ("BBB.xls!TestBBB")
works fine (thanks to Mark Dullingham).

Now change the scenario:
Change the name of the BBB.xls WB to "BB B.xls" (insert a space in the name)
The code (in AAA.xls):
Application.Run ("BB B.xls!TestBBB")
produces an error "Macro 'BB B.xls!TestBBB' cannot be found."

My question: What is the proper syntax for the Application.Run statement
when the target workbook has a multi-word name?
Thanks for your time. Otto



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Multi-word WB name

How about:
Application.Run "'BB B.xls'!TestBBB"
(not ()'s required)

I like:

dim BBBWkbk as workbook
set BBBwkbk = workbooks("bb b.xls") 'or whatever
Application.Run "'" & BBBwkbk.name & "'!TestBBB"

By using a variable, I only have one location to change if/when that workbook
needs to change.



Otto Moehrbach wrote:

Excel XP & Win XP
I have 2 workbooks open, AAA.xls & BBB.xls.
I want to run macro TestBBB, located in BBB.xls, from within AAA.xls.
The code (in AAA.xls):
Application.Run ("BBB.xls!TestBBB")
works fine (thanks to Mark Dullingham).

Now change the scenario:
Change the name of the BBB.xls WB to "BB B.xls" (insert a space in the name)
The code (in AAA.xls):
Application.Run ("BB B.xls!TestBBB")
produces an error "Macro 'BB B.xls!TestBBB' cannot be found."

My question: What is the proper syntax for the Application.Run statement
when the target workbook has a multi-word name?
Thanks for your time. Otto


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Multi-word WB name

To All
That worked great. Thanks for your time. Otto
"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
I have 2 workbooks open, AAA.xls & BBB.xls.
I want to run macro TestBBB, located in BBB.xls, from within AAA.xls.
The code (in AAA.xls):
Application.Run ("BBB.xls!TestBBB")
works fine (thanks to Mark Dullingham).

Now change the scenario:
Change the name of the BBB.xls WB to "BB B.xls" (insert a space in the
name)
The code (in AAA.xls):
Application.Run ("BB B.xls!TestBBB")
produces an error "Macro 'BB B.xls!TestBBB' cannot be found."

My question: What is the proper syntax for the Application.Run statement
when the target workbook has a multi-word name?
Thanks for your time. Otto



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Excel count of 1 word if found in multi-word cells of column Function_Challenged Excel Worksheet Functions 1 August 27th 09 12:08 AM
Converting a Word doc to a multi-column Excel spreadsheet DD Pgh Excel Worksheet Functions 0 January 12th 09 06:42 PM
Merge Excel multi columns into Word [email protected] Excel Worksheet Functions 0 August 16th 06 10:27 AM
embed multi-page Word document kgr798386 Excel Discussion (Misc queries) 0 June 28th 06 11:03 PM
Multi-Page Word Doc Linked to Excel? Kalea Excel Discussion (Misc queries) 2 March 17th 05 11:29 PM


All times are GMT +1. The time now is 03:29 PM.

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"