PDA

View Full Version : Solved: Call a macro stored in Personal.xls



Marcster
02-08-2006, 03:14 AM
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.

Marcster
02-08-2006, 03:23 AM
I've sorted it now.

Run ("PERSONAL.XLS!ThisIsInPersonal")

Thanks,

Marcster.

Cyberdude
02-08-2006, 09:00 PM
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.

xld
02-09-2006, 01:56 AM
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.

Marcster
02-09-2006, 02:30 AM
Hi Guys,

Sorry :o: ,

I should of posted:
Run "PERSONAL.XLS!ThisIsInPersonal", msg
As in (in workbook:)

Sub testDisplayMessageInPersonal()
Dim msg As String
msg = "Heres some text"
Run "PERSONAL.XLS!ThisIsInPersonal", msg
End Sub

In PERSONAL.XLS:

Sub ThisIsInPersonal(strMsg As String)
MsgBox strMsg
End Sub


Marcster.

Zack Barresse
02-09-2006, 08:14 AM
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).

Cyberdude
02-10-2006, 04:00 PM
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.footinmout