Excel Toolbar / Commandbar via VB6

cdwell1965
06-03-2008, 06:57 AM
I have developed an application using VB6 / Excel automation for accepting weight data from a couple of analytical balances via RS232. I put the data into an Excel for calculation purposes. The application consists of multiple forms one of which is used to open and close Excel.

The problem I have is that when Excel is launched from my VB application, it is maximized and covers up my VB Excel control panel (Userform). Because of the size of the spreadsheet, it has to be maximized so the user can see what he/she is doing when entering data.

I would like to know if there is a way to programmatically place my VB Excel control panel - userform on the Excel toolbar so it'sreadily available to the user. Once they have completed entering data into the spreadsheet, they would not have to go looking for the panel. Right now they have to minimize Excel to locate the control panel. A simple floating panel that is always present would work as well.

Hopefully I have explained this well enough that someone can point me in the right direction. Thanks.

Timbo
06-03-2008, 08:29 AM
Welcome to the forum cdwell1965 :)

From what I gather, it sounds like you have a VB6 exe which launches a stand-alone form. At some point the users use this form to launch a particular Excel file which they need to edit. After they have finished, then then need to use the app's form for other tasks, but currently it gets hidden by the Excel instance.

Right so far? Add an embellishments as required!

cdwell1965
06-03-2008, 06:56 PM
Basically. My app has several forms for various functions but the form that I need to stay active ( on top ) while using/editing the Excel spreadsheet is the one that launches Excel, saves and closes the Excel file, closes Excel, and exits back to the main form. Once Excel launches, this form is hidden behind the Excel spreadsheet. One need only minimize Excel to find and use it but I have several people with varying degrees of computer experience. The less they have to hunt around the Desktop for something the better. I was simply hoping there was a way to have this particular form stay on top while using Excel. I would be happy to have the form stay on top and allow the user to simply move it around the screen if it gets in the way. It does not necessarily have to be part of Excel.

Timbo
06-04-2008, 02:28 AM
Are the users being presented with the same Excel file, or does your app create a fresh one for every session?

If the former, is there any reason why you can't add a UserForm to the Excel file, and invoke that while the users are working within Excel?

Still lacking the full picture here - the more detail you add to the picture un-prompted, the quicker we'll arrive at a solution ;)

cdwell1965
06-04-2008, 09:05 AM
The Excel file that is launched by my VB6 App is a template file that is used over and over again. The user populates the template file with data then clicks on the VB6 app commadbutton "Close Excel" which opens a Common Dialog that allows them to save the file under a different name. The new file is stored in a new location and the template file is closed and ready to use again. Since the "Close" button is not readily visable, I am afraid the user will simple save over my template file.

Maybe the obvious has escaped me, but are you suggesting letting my app open the template but write a VBA macro in Excel to do everything with my Excel file?

Timbo
06-04-2008, 10:24 AM
Well it's an option ;)

However, if you save your master template as an xlt and deploy that rather than the xls, then users will nver be able to overwrite it. Would that solve all your issues?

cdwell1965
06-05-2008, 09:45 PM
What I was needing and did not know exactly how to word was a way to keep my form "on top" while the user uses Excel. I have found my solution and it seems to work well. I have simply accessed a Windows API that lets me do it using the numeric handle of my form.

My form now stays "on top" of Excel while the user enters data. They do not have to go looking for the form anymore.

Thanks

Timbo
06-06-2008, 03:06 AM
While a hammer is a very useful tool to have in your box, it's not always the right one for the job. I simply wanted to help you determine what the best solution for your project was - hope it works out in the end :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum