New topic: 

Run Excel Macros from RB

<http://forums.realsoftware.com/viewtopic.php?t=45740>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        Luis          Post subject: Run Excel Macros from RBPosted: Sat 
Oct 27, 2012 2:28 pm                         
Joined: Wed Oct 08, 2008 6:55 pm
Posts: 12
Location: Eden Prairie, MN, USA                Hello,
I am trying to run a recorded Macro in Excel, from RB. I search this forum and 
found exactly what I was looking for, but wonder why if does not work. I tried 
different ways to call the Active Workbook, Worksheet, etc. etc. 
The original msg. is called "Excel Automation" and dates back to 2006. I found 
it by searching with the keyword "Macro"
In that article it was suggested the following,
Quote:Well, I think doing the second is fairly trivial:

1. Write your macro (in VBA) in your workbook
2. Use the following command in Rb to run that macro:

myExcelApplication.Run("MyGraphicMacro!MyMacroWorksheet") 

..and that is what I have been trying to do. I am sure the above structure 
works but I just cannot find where my mistake is. The listing below is not 
complete but shows what I am doing. The rest of code is just the closing of 
Excel after some calculations. 
The last line of code is the troublemaker!! 
In this last line of code "Ordering" is the name I assigned to the recorded 
Macro and saved in the "OrderingMacro.xls" workbook.

I will appreciate some insights or guidance.



Dim excel As New ExcelApplication
Dim book As ExcelWorkbook
Dim sheet As ExcelWorksheet
book = Excel.workbooks.open("C:\Files and Documents\RealStudio\Programming 
Excel\Projects\OrderingMacro.xls")
excel.visible=true
excel.book.ActiveWorksheet.Run("Ordering!Sheet1")


Thanks
Luis.   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to