![]() |
Run/Execute string expression
I would greatly appreciate any ones help on this one. I would like to run/execute code that is stored as a sting in excel, I think I have part of the problem solved.... I can get the following piece of code to work using a function eval (from mircosoft access 9.0 object library) ------------------------------------------------------------------------------ Sub test() Dim codetest As String codetest = "msgbox(""HELLO"")" eval codetest End Sub ------------------------------------------------------------------------------ .......but when I try and use it on an excel object like this snippet of pivottable code then... ------------------------------------------------------------------------------ dim codetest as string codetest = ("ActiveSheet.PivotTables(""PivotSpend"").AddField s(""Spend"")") eval codetest ------------------------------------------------------------------------------ ....I get this error MIRCOSOFT ACCESS CAN'T FIND THE NAME ACTIVESHEET YOU ENTERED IN THE EXPRESSION. Any ideas on how I can get it to work?? Or is there another way to solve this problem... Thanks :) :) -- Hammas ------------------------------------------------------------------------ Hammas's Profile: http://www.excelforum.com/member.php...o&userid=27642 View this thread: http://www.excelforum.com/showthread...hreadid=471651 |
All times are GMT +1. The time now is 01:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com