Thread: Desktop icon
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel[_572_] joel[_572_] is offline
external usenet poster
 
Posts: 1
Default 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