Friday, May 13, 2011

Tips: How to deploy the excel macros from a central file

By default, when you create a macro for a Microsoft Excel worksheet, that macro works only on that worksheet. This behavior is okay as long the macro automates tasks that are unique to that worksheet. But have you ever found yourself recreating the same macro on more than one worksheet? If you have (and even if you haven't), you can copy your macros to a worksheet called personal.xls. From there, your macros become available to you whenever you start Excel, and you can run them against the data on any open worksheet.
Surely, everyone knows about the Macro feature of the Microsoft Office Application. If you create a Macro for a Microsoft Excel worksheet, that will work only on that particular worksheet. This will be okay as long as the Macro automates the tasks that are unique to that particular worksheet. However, have you ever found a way to recreate the same macro on more than one worksheet? If so, you can copy your macros to a worksheet called personal .xls. Therefore, the Macros will be available to you whenever you start Excel and you will be able to run them against the data on any open worksheet. Moreover, as it is required to be careful here, it is not required to run the Macros at random and doing so will corrupt the data and cost you time and money. But if you have macros that you can use in a variety of situations, using a personal.xls file can also save your time and money.



Now, let’s discuss about starting it.
If you’re going to follow these steps, it is required to open an Excel worksheet that has at least a Macro. If you wish to create a sample Macro, you can follow the following steps.
•    First, start excel and open a new blank workbook.
•    Now, on the Tools menu, point to Macro and then click Visual Basic Editor.
•    Then, in the Project window, it is required to double click ThisWorkbook.
•    After that, copy and paste this code into the code window.
sub test()
MsgBox "This is only
a test."
end sub
5.    After that, it is required to save the file to your default working folder.
6.    Now, it is required to quit the Visual Basic Editor and close the workbook.
Now, let’s discuss about creating a personal.xls file.

If you wish to create and use a personal .xls file, you can follow the following process.
•    Use Microsoft Windows Explorer to create a blank personal.xls file in the folder called XLStart. If you installed Microsoft Office in the default location, you'll find \XLStart under C:\Program Files\Microsoft Office\Office 10. If you installed Office in a different location, find \XLStart there.
•    Hide the file in Excel (Window menu, Hide command).
•    Unhide the file (in the world of Excel, "unhide" is a real word), copy your macros from their parent worksheets to the file, and then hide personal.xls again.
•    If you wish, you can keep the personal.xls file hidden unless you wish to add Macros to it.
•    Whenever you start excel, the personal.xls fill automatically open and run in the background.
•    At the same time, if you don’t wish to hide the file, you will be able to add data to it.

How to hide personal.xls
1.    Start Excel and open personal.xls.
2.    On the Window menu in Excel, click Hide, and then quit Excel.
3.    When asked if you want to save your changes, click Yes. The workbook will open silently and become available the next time you start Excel.

B y , ,