Developer of several fully secured Microsoft Access Applications for Corporate Houses. From September 2006 onwards, publishing Blog Articles on Microsoft Access Programming Tips and Tricks, with easy to follow Examples & VBA Source Code.
Web Site: http://www.msaccesstips.com
We have seen in the earlier Article Microsoft Excel and Automation that with a simple Macro Statement we could transfer control to a particular area of Worksheet very quickly, when several Worksheets are there in a Workbook. We have designed a Control Sheet and a Control Data Sheet to store the user’s choices and use those values for running the Program.
Excel Macros can make our work easier by automating several tasks like Print Previewing or Printing of Worksheets, hiding all worksheets except the one that we are working on, transfer data from other worksheets to a specific range linked with the Graph Chart so that the Chart changes dynamically and no need for creating several Charts across sheets and so on.
We can bring in lot of improvement in that example Workbook that we have created earlier and in this Article we will concentrate on a simple issue, specific to what we did with the earlier macro. We have seen that we can transfer control to a particular worksheet among several worksheets in order to avoid scrolling sheets to the right to find the specific sheet location that we want to work with. If you have tried that example, then a Question is already on your mind that how do we pass control back to the Control Sheet, without clicking on the Tab Scrolling Buttons?
Since, we have transferred control with a macro we need another macro to bring the control back to Main worksheet where we have designed the List boxes and Command Button for automation. But this macro we cannot run from the Main Control Sheet. We will run it conveniently from a Toolbar Button above. We need to create a custom Toolbar Button and attach the new Macro to the Toolbar Button. But, the new Toolbar Button will remain in the machine where you will create it. If the same workbook is open in a different machine the Button will not be available there, but we can make the Custom Toolbar Button to travel with the Workbook so that it can be used in any machine.
First we will write a Macro and then go for the Custom Toolbar Button creation.
1. Select Tools - -> Macros - -> Visual Basic Editor.
2. Click on the Project Explorer Toolbar Button (or press Ctrl+R) to split the Visual Basic Editor window into two. Left side panel will list the Worksheet names and the right-side window is for VBA Code editing. Check the left side panel under the heading This Workbook shows a Folder with the name Modules. If you are using the same workbook that you have created for the earlier example then this will be there. If the Module Folder is there then double click on the VBA Module below that to open up the VBA Code Editing window. If the Module Folder is not there then select Insert - -> Module to insert a Global VBA Module.
3. Click on the Code window at the right side and select Procedure from Insert Menu.
4. Type the Name GotoControl in the Name control and select Sub in the Type Category.
5. Select Public in the Scope choices.
6. Click OK to insert the empty Procedure skeleton in the VBA Window.
7. Type the following Macro Statement without making mistakes in the middle of the two lines. See that you are keying in a period (.) between the right parenthesis and the word select.
Worksheets ("Control") .select
1. Select View - -> Toolbars - -> Customize.
2. Select the Toolbars Tab (if it is not the current one)
3. Click New to create a new Empty Toolbar and type a Name (say myToolbar) in the Toolbar Name control and click OK. An Empty Toolbar will show up, look for it if you could not spot it. It may appear anywhere within the Excel Application Area. You may drag and place it among the existing Toolbars above.
4. Click on the Commands Tab on the Customize dialog control.
5. Click on File in the Categories List and Click New...
6. Right-Click on the Button and type &Go2Ctrl in the Name Control.
7. Select Text Only option in the displayed menu. The Name Go2Ctrl appears in the Button face.
8. Click on the Assign Macro to display all the existing Macros available and among them you will find the GotoControl that we have created, click on it and Click OK and Close the Customize Dialog Control.
9. Now we are ready to test our creation. Click on the Go2Ctrl Toolbar Button and you will be placed on the Control Worksheet.
10. Click on the Goto Command Button after selecting a Worksheet and Month from the List to transfer control to that sheet.
11. Try clicking again on the Go2Ctrl Toolbar Button to jump the control back to the Main Worksheet.
Now, we need to make one more change for the Toolbar to travel along with the Workbook to other machines.
1. Select View - -> Toolbar - -> Customize.
2. Click on the Attach... Button.
3. You will find Custom Toolbars List at the left-side panel. Select myToolbar from the list and Click Copy Button to make a copy to the Toolbars in Workbook List.
4. Click OK to Close the Customize dialog box.
If your Excel File can be put on a Network Drive then you can try opening it from a different Machine. The Custom Toolbar with the Go2Ctrl Button will come along with the Workbook on that machine also.
a.p.r. pillai
http://www.msaccesstips.com
- Related Videos
- Related Articles
- Ask / Related Q&A
- Microsoft Excel and Automation-2
- Microsoft Excel and Automation
- Augment Your Forex Profit With Automated Forex Bot
- Software Solutions-managing Trade the Automated Way!
- Brute force seo EVO II release give Advice for multilingual SEO Part 1 with multilangual toolbar
- brute force evo II give Advice for multilingual SEO Part 1 with multilangual toolbar
- Automated Forex Bot – the Software to Ease Forex Trade
- Act 6.0




Software Development at Its Real Best
By: Arun Kumar | 02/01/2010The demand for software has increased in such a manner that if the developers stop working for a day, the entire world of business would surely come to a cease. That’s where the present day software development solutions providers strike the chord playing the tunes of their profit.
Why Ares is better choice for download music, movie, DVD?
By: Ares | 02/01/2010Ares download is becoming one of the good choice for downloading movie, music and DVD movie today. The reason is this because it is very user friendly. User can easily download without any spyware and adware. No third site service required to download. User can categorized their downloading files easily.
Easy Option to Convert Contacts from .CSV to PST
By: Sys Tools | 02/01/2010There are many people who make use of MS Excel to store their contacts and MS Outlook email client to send/receive emails. SysTools Excel to Outlook Software can transfer contacts from Excel to Outlook. The software provides a unique feature – to export contacts from .CSV to Outlook PST. Now, if you make use of .CSV format in Excel to store your email contacts, then you can now very easily import CSV contacts to Outlook with the help of this software.
Career Development Centre: Guiding you towards a right career track
By: HCL Career Development Centre | 02/01/2010Career Development has become a primary responsibility and an essential requirement for every individual in any organization. A profound career development skill can help an individual to meet the constantly changing needs of the market. For more information visit: www.hclcdc.in
What RFID Healthcare Software Can Do For Your Office
By: Tom Gruich | 01/01/2010Whether your office is large and busy or small and growing, making use of RFID tracking and the latest healthcare software can improve your office manager’s ability to track assets, ensure patient safety and control access to patient records.
Satellite Direct TV Software Review - TV On The Computer
By: Rose Daly | 01/01/2010Watching satellite TV on your personal computer has truly come a long way over the past year. There’s no wires, no additional hardware and to top it all you don’t have to be a computer expert, all you need is software and you can now enjoy watching your favorite shows. One of the best TV to PC software available online is Satellite Direct TV Software that will allow you to watch all your favorite TV channels such as sports, premium movie channels, international TV shows and many other genres.
Free Live TV On Internet - Satellite Direct TV Software
By: Rose Daly | 01/01/2010Free live TV on Internet has a lot of benefits and advantages. You don’t have to bother purchasing expensive flat screen TV, LCD or Plasma just to watch your favorite shows. Now it is possible to enjoy your favorite TV shows plus so much more via the Internet and over your very own personal computer.
How To Watch Satellite TV On PC - Satellite Direct TV Software
By: Rose Daly | 01/01/2010With the advanced technology we have right now everything is possible and achievable. In this view a new and emerging technology on the market is watching satellite TV on your own personal computers and it is fast gaining popularity nowadays most especially with the younger individuals. A lot of people are also opting for TV with high definition features as well as satellite TV viewing capabilities. This will enable everybody to watch satellite TV without all the hassles of setting up dish and r
Microsoft Excel and Automation
By: Ramachandran Pillai | 17/06/2008 | SoftwareA peep into the History and evolution of Worksheet Software. There are several tasks that can be automated in Microsoft Excel with VBA and working with Excel can be made interesting and time saving to the Users. We will look into a simple task that runs with Macros, which is easy to understand and you can implement it in no time.