Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Desktop icon
Can I call Access from a desktop short with with VBA
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Desktop icon
You need to run the DLL ShellExecute. I assumed the Icon was in you poersonnal DeskTop and not the All Users. I tested with Spybot but you can use any ICON. Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub test() IConName = "Spybot - Search & Destroy" HomePath = Environ("HomeDrive") & Environ("Homepath") DeskTop = HomePath & "\" & "DeskTop" RetVal = ShellExecute(0, "open", IConName, "<arguments", _ DeskTop, SW_SHOWMAXIMIZED) End Sub -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170758 Microsoft Office Help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Desktop icon
I get the following compile error when I try to run this
"Constants,fixed- length strings,arrays, user dedined type and Declare statementsnot allowed as Public member of object modules" Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub test() IConName = "Customers.mdb - Shortcut" HomePath = Environ("HomeDrive") & Environ("Homepath") DeskTop = HomePath & "\" & "DeskTop" RetVal = ShellExecute(0, "open", IConName, "<arguments", _ DeskTop, SW_SHOWMAXIMIZED) End Sub "joel" wrote: You need to run the DLL ShellExecute. I assumed the Icon was in you poersonnal DeskTop and not the All Users. I tested with Spybot but you can use any ICON. Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub test() IConName = "Spybot - Search & Destroy" HomePath = Environ("HomeDrive") & Environ("Homepath") DeskTop = HomePath & "\" & "DeskTop" RetVal = ShellExecute(0, "open", IConName, "<arguments", _ DeskTop, SW_SHOWMAXIMIZED) End Sub -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170758 Microsoft Office Help . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Desktop icon
I copied the code exactly from the posting and did not get any errors. Put the code below on a new module exactly as posted and see if you get any errors with no other macros. I put the code in a VBA module. theis code should work in excel 2000 and above. Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub test() IConName = "Customers.mdb - Shortcut" HomePath = Environ("HomeDrive") & Environ("Homepath") DeskTop = HomePath & "\" & "DeskTop" RetVal = ShellExecute(0, "open", IConName, "<arguments", _ DeskTop, SW_SHOWMAXIMIZED) End Sub "joel" wrote: You need to run the DLL ShellExecute. I assumed the Icon was in you poersonnal DeskTop and not the All Users. I tested with Spybot but you can use any ICON. Const SW_SHOW = 1 Const SW_SHOWMAXIMIZED = 3 Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub test() IConName = "Spybot - Search & Destroy" HomePath = Environ("HomeDrive") & Environ("Homepath") DeskTop = HomePath & "\" & "DeskTop" RetVal = ShellExecute(0, "open", IConName, "<arguments", _ DeskTop, SW_SHOWMAXIMIZED) End Sub -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: 'Desktop icon - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=170758) 'Microsoft Office Help' (http://www.thecodecage.com) . -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170758 Microsoft Office Help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Control desktop Icon | Excel Programming | |||
Desktop File Icon | Setting up and Configuration of Excel | |||
Desktop icon name | Excel Programming | |||
how can i put the excel icon on my desktop? | Excel Discussion (Misc queries) | |||
Delete desktop icon with VBA | Excel Programming |