Hi people,
How do I call a macro via VBA which is held in Personal.xls?
Tried the usual:
Call ThisIsInPersonal
but errors with:
Sub or Function not defined.
Thanks,
Marcster.
Hi people,
How do I call a macro via VBA which is held in Personal.xls?
Tried the usual:
Call ThisIsInPersonal
but errors with:
Sub or Function not defined.
Thanks,
Marcster.
I've sorted it now.
Run ("PERSONAL.XLS!ThisIsInPersonal")
Thanks,
Marcster.
Hey, Marcster, I don't quite understand what you are trying to do. Referring to a macro should result in an automatic search in all your references including Personal.xls. You shouldn't have to qualify it in any way. That's why Personal is such a handy place to put common macros.
That is not correct. You either have to use Run to call a macro in another workbook, or you need to set a reference to that project.Originally Posted by Cyberdude
Hi Guys,
Sorry ,
I should of posted:
[VBA] Run "PERSONAL.XLS!ThisIsInPersonal", msg[/VBA]
As in (in workbook
[VBA]
Sub testDisplayMessageInPersonal()
Dim msg As String
msg = "Heres some text"
Run "PERSONAL.XLS!ThisIsInPersonal", msg
End Sub
[/VBA]
In PERSONAL.XLS:
[VBA]
Sub ThisIsInPersonal(strMsg As String)
MsgBox strMsg
End Sub
[/VBA]
Marcster.
Fwiw, I generally recommend staying away from setting a reference to another workbook. I think it's bad habit and it can create an error-prone environment which can be hassling to the user(s).
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
xld and maracster, sorry for the bum recommendation. I've had Personal referenced to all my workbooks for so long that I forgot I did it. I was thinking that you get that reference for free, so to speak. I guess it isn't automatic after all.