If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Minimizing Excel In VBA & hiding menu options

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-05, 09:12
eddiesvoicebox eddiesvoicebox is offline
Registered User
 
Join Date: Sep 2004
Location: London
Posts: 63
Minimizing Excel In VBA & hiding menu options

Hi all,
Does anyone know the code to minimize Excel in the background while an XL form is open. I already know how to use veryhidden on the sheet tabs but it would be convenient if the form would show on its own, or can i set the excel window size to the same as the form size ? ? ?

On a secondary note is it possible to completely hide all the toolbars (including the menu bar) when the form is opened

Many thanks in advance

Eddiesvoicebox
Reply With Quote
  #2 (permalink)  
Old 01-24-05, 23:33
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
Does anyone know the code to minimize Excel in the background while an XL form is open.

For this to work right you want to have a process run 'on-open' to display your user form, and you want to open a new instance of the Excel Application when your program starts. Then when the form is closed the Excel application is closed with the userform. This will prevent multiple copies of Excel being opened.

Create a Shortcut for your application. The target path must point to the Excel App. you must type exactly this format with the quotes included in the paths.

Target:
"C:\Program Files\Microsoft Office\Office\EXCEL.EXE" "C:\Program Files\BackUtility\Backup.xls"
Start In:
"C:\Program Files\Microsoft Office\Office"
Run:
'Minimized' (list option)

This code will minimize the Excel App. But if you don't use Run Minimized in a shortcut the user will see the window go to the task bar. Once Minimized you must call 'AppActivate' and SetFocus to the form or your user form will not be accessable without the user physically clicking the Application title in the taskbar. Change the app title and file paths to match your system of course.

Code:
 
' Modless is called from the workbook_open sub
' auto runs when workbook is opened
' set it in ThisWorkbook Excel Object

Sub Modeless()
' Developed 1/20/04 savBill
    Application.Caption = "Backup Program"
    Application.ShowWindowsInTaskbar = False
    Application.WindowState = xlMinimized
    ReturnExcel
    Application.Assistant.Visible = False
    UserForm1.cmdBackupFiles.SetFocus
    UserForm1.Show
End Sub

Sub ReturnExcel()
  AppActivate "Backup Program"
End Sub
Secondary Note:
Check out http://archive.baarns.com/. The Excel developer Jump start package uses a process to hide all the toolbars, but makes a list to put them all back on close. Fair warning, it was written for Excel 97. I did not have good luck with the toolbar hiding process when I tried it once a long time ago. Theres some good stuff in there, may give you some ideas.


/
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 01-25-05, 05:16
eddiesvoicebox eddiesvoicebox is offline
Registered User
 
Join Date: Sep 2004
Location: London
Posts: 63
Many thanks for the reply, that did the trick nicely.

Thanks again.

Eddiesvoicebox
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On