View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Run macro from name stored in variable?

I should have added that your called code must be in a regular
code module, not a sheet module, form module, or the ThisWorkbook
code module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Your code works fine for me. Try removing the parentheses from
the Application.Run statement.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"chubster264"

wrote in message
...

Thanks for the suggestion - I'm getting an error 1004 though
when I run
the code as below... Any further suggestions as to what might
be the
problem?



Sub temp1()

MsgBox "hello"

End Sub

---------------------

Sub trythemacro()

Dim mName As String

mName = "temp1"

Application.Run (mName)

End Sub


--
chubster264
------------------------------------------------------------------------
chubster264's Profile:
http://www.excelforum.com/member.php...o&userid=30164
View this thread:
http://www.excelforum.com/showthread...hreadid=498463