Call procedure using Application.Run

G

Guest

I am trying to call a procedure in another workbook. I first tried to set up
a reference to use in the code, but got some error related to the reference
name that wouldn't allow it. So I'm trying what seems to be the better way.

Application.Run "Doc Check.xls!update_status"

But it says the macro 'Doc Check.xls!update_status' cannot be found
(Run-time error 1004). Is there something I'm getting wrong in my syntax?
Should I declare the Module? I'm running Excel 2000 with VB 6.0.

Thanks in advance for passing on your insight.
 
D

Dave Peterson

Try changing the project name from VBAProject (for Doc check.xls) to something
nice and unique: DocCheck

Then try the reference.

Or

Application.Run "'Doc Check.xls'!update_status"
 
B

Bob Phillips

Application.Run "'Doc Check.xls'!update_status"


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
G

Guest

Thanks Dave. The space was in the file name when I inheritted it so I didn't
want to rename the file, then have to modify any/all references to it. I am
assuming, though, that to change the project name I would have change the
file name. Is there another way to change the project name? Regardless,
from your response and Bob's it seems I may have just been missing an
apostrophes ( ' ). Time to get some glasses.

Thanks!
 
G

Guest

Nevermind that last question. It's pretty straight forward in the Help file.
Just never had a reason to rename a project before.

Thanks again.
 
G

Guest

Thanks Bob.

Bob Phillips said:
Application.Run "'Doc Check.xls'!update_status"


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
D

Dave Peterson

The project name isn't the same as the workbook name. In fact, I bet the
current project name is VBAProject--that's the default for all projects.
 
D

Dave Peterson

Ignore my last response <vbg>.
Nevermind that last question. It's pretty straight forward in the Help file.
Just never had a reason to rename a project before.

Thanks again.
 

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