i have a program i use all the time, but i never directly open it with Excel. it is a set of forms that does a lot of things and it works great.
i use a .vbs file to open it:
i have, at the open of excel, the form launch and then make the application invisible:
what this does is allows an excel related program to open w/o ever 'seeing' excel open. excel remains invisible, the 'engine' for the program, but not the program of focus.
all this is great *but* when opening excel this way no icon appears on the task bar. i was wondering if there is a way to tell excel at the open:
'open invisibly except for the icon on the task bar'
i can change the icon to my own custom icon this way:
but if the app is otherwise invisible it wont show.
i use a .vbs file to open it:
Code:
on error resume next
set app = createobject("excel.application")
app.usercontrol = true
set wb = app.workbooks.open (replace(wscript.scriptfullname,wscript.scriptname,"file.xls"))
if wb is nothing then app.quit
i have, at the open of excel, the form launch and then make the application invisible:
Code:
Private Sub Workbook_Open()
Form1.Show
Application.Visible = False
End Sub
what this does is allows an excel related program to open w/o ever 'seeing' excel open. excel remains invisible, the 'engine' for the program, but not the program of focus.
all this is great *but* when opening excel this way no icon appears on the task bar. i was wondering if there is a way to tell excel at the open:
'open invisibly except for the icon on the task bar'
i can change the icon to my own custom icon this way:
Code:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Const WM_SETICON = &H80
Sub SetExcelIcon()
Dim lngXLHwnd As Long, lngIcon As Long, strIconPath As String
'Change this to a valid icon path on your network/drive
strIconPath = "C:\myico.ICO"
lngXLHwnd = FindWindow("XLMAIN", Application.Caption)
lngIcon = ExtractIcon(0, strIconPath, 0)
SendMessage lngXLHwnd, WM_SETICON, False, lngIcon
End Sub
but if the app is otherwise invisible it wont show.