How to run macros from personal.xlsb
-
Montag, 16. April 2012 10:11
Hi all,
Hi all
How to run the macros in excel from personal.xlsb folder. Here is my code. But the code is not working. Please help
With thanks
Pol
Excel.Application ExcelObj = null; ExcelObj = new Excel.Application(); ExcelObj.Visible=true; Excel.Workbooks books = ExcelObj.Workbooks; Excel.Workbook sheet = books.Open(@"c:\Excel\PriceList1.xls"); ExcelObj.Run("PERSONAL.XLSB!AdjustColumn");polachan
- Verschoben Bob ShenMicrosoft Contingent Staff Mittwoch, 18. April 2012 06:32 (From:Visual C# General)
Alle Antworten
-
Montag, 16. April 2012 11:23Why would you expect an answer in a C# forum? Maybe an Office or Excel forum is the place to look?
Regards David R
---------------------------------------------------------------
The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
Every program eventually becomes rococo, and then rubble. - Alan Perlis
The only valid measurement of code quality: WTFs/minute. -
Donnerstag, 19. April 2012 02:35Moderator
Hi Pol,
Welcome to the MSDN forum!
We have to specify the location of the PERSONAL.XLSB file, and enclose it with apostrophe. Please try the following statement:
Excel.Workbook oWorkbook = oApp.Workbooks.Open("E:\\Test\\Test.xlsm"); oApp.Run(@"'C:\Users\User\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.XLSB'!TestMsg");Note: You need to replace the path with the actual environment.
Thanks.
Yoyo Jiang[MSFT]
MSDN Community Support | Feedback to us
- Als Antwort markiert Yoyo JiangMicrosoft Contingent Staff, Moderator Donnerstag, 3. Mai 2012 02:56

