HI,
I am trying to insert this code in macro to open a workbook. If already opened, activate it. But for some reason it does not work.
Please help me on this.HTML Code:
Thank you
Jaz
HI,
I am trying to insert this code in macro to open a workbook. If already opened, activate it. But for some reason it does not work.
Please help me on this.HTML Code:
Thank you
Jaz
Last edited by jazbath; 09-17-2009 at 02:08 PM.
A reference to an open workbook doesn't include the path.
![]()
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
Hi Shg,
Thanks for helping me on this. Where do I ned to put the function?
I inserted in the same workbook as function, it says "Object does not support this porperty or method.
Jaz
Last edited by jazbath; 09-16-2009 at 08:07 PM.
Put the stand-alone function in a code module.
The declarations and code fragment above it replace the code you posted in whatever macro it was in.
Hi Shg,
I did as you mentioned. But still it gives me a run time error 438
in the following line:
Workbooks(sWkb).Select --- Object does not support this property or method.
If the workbook is closed it works well, but if it is open then the above error occurs.
Jaz
Post your code.
I think that the method should be Activate, not Select
Buran is correct (thank you), my apologies.
Brain cramp ...
Hi Shg & Buran,
Changing from Select to Activate solved the problem.
Thank you to both of you.
Jaz![]()
By the way it is worth to check if the path of the opened workbook is the same as sPath. This way you will avoid problems if for any reason there is opened another file with the same name, but at different location.
![]()
Please Login or Register to view this content.
Hi Shg,
Nothing to apologize. You were helping..
Thank you
Jaz
Buran,
Although in my case I know I do not have any other file with that name, but it is a good idea.
Thanks
Jaz
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks