![]() |
Call procedure using Application.Run
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. |
Call procedure using Application.Run
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" xlcharlie wrote: 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. -- Dave Peterson |
Call procedure using Application.Run
Application.Run "'Doc Check.xls'!update_status"
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "xlcharlie" wrote in message ... 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. |
Call procedure using Application.Run
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! "Dave Peterson" wrote: 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" xlcharlie wrote: 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. -- Dave Peterson |
Call procedure using Application.Run
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. "Dave Peterson" wrote: 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" xlcharlie wrote: 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. -- Dave Peterson |
Call procedure using Application.Run
Thanks Bob.
"Bob Phillips" wrote: Application.Run "'Doc Check.xls'!update_status" -- HTH Bob Phillips (remove nothere from email address if mailing direct) "xlcharlie" wrote in message ... 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. |
Call procedure using Application.Run
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. xlcharlie wrote: 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! "Dave Peterson" wrote: 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" xlcharlie wrote: 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. -- Dave Peterson -- Dave Peterson |
Call procedure using Application.Run
Ignore my last response <vbg.
xlcharlie wrote: 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. "Dave Peterson" wrote: 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" xlcharlie wrote: 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. -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 02:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com