Windows Vista Forums

Error setting shortcut icon
  1. #1


    John Guest

    Error setting shortcut icon

    Hi

    I am using below code to create an icon on desktop;

    dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
    Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
    dstFolderFile = dstFolder & "\My App.exe"

    Set objShell = CreateObject("WScript.Shell")
    strFolder = objShell.SpecialFolders("AllUsersDesktop")
    Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")

    link.Description = "My App"
    link.TargetPath = dstFolderFile
    link.WorkingDirectory = dstFolder
    link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
    link.Save

    Problem is I am getting the belwo error on line 'link.SetIconLocation
    "C:\Windows\System32\SHELL32.dll", 13';

    Error: Object doesn't support this property or method:
    'link.SetIconLocation'

    What is the problem and how can I fix it?

    Thanks

    Regards





      My System SpecsSystem Spec

  2. #2


    Charles E Finkenbiner Guest

    Re: Error setting shortcut icon

    Hi John,

    I see 2 errors in your line of code. You posted this line as your problem:

    'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'

    The 2 errors I see are that you left out the = sign and you have your
    closing double-quote in the wrong place. The correct code should be:

    link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"


    Hope this helps,

    CEF

    John wrote:

    > Hi
    >
    > I am using below code to create an icon on desktop;
    >
    > dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
    > Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
    > dstFolderFile = dstFolder & "\My App.exe"
    >
    > Set objShell = CreateObject("WScript.Shell")
    > strFolder = objShell.SpecialFolders("AllUsersDesktop")
    > Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
    >
    > link.Description = "My App"
    > link.TargetPath = dstFolderFile
    > link.WorkingDirectory = dstFolder
    > link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
    > link.Save
    >
    > Problem is I am getting the belwo error on line 'link.SetIconLocation
    > "C:\Windows\System32\SHELL32.dll", 13';
    >
    > Error: Object doesn't support this property or method:
    > 'link.SetIconLocation'
    >
    > What is the problem and how can I fix it?
    >
    > Thanks
    >
    > Regards

      My System SpecsSystem Spec

  3. #3


    John Guest

    Re: Error setting shortcut icon

    Hi

    Thanks. I have tried

    link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"

    but still same error "Object doesn't support this property or method:
    'link.SetIconLocation'". If I rem out this line then shortcut is created
    fine on the desktop.

    Thanks

    Regards

    "Charles E Finkenbiner" <CharlesEF_@_CEF-Inc.Com> wrote in message
    news:usy2cTtoJHA.3332@xxxxxx

    > Hi John,
    >
    > I see 2 errors in your line of code. You posted this line as your
    > problem:
    >
    > 'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'
    >
    > The 2 errors I see are that you left out the = sign and you have your
    > closing double-quote in the wrong place. The correct code should be:
    >
    > link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
    >
    >
    > Hope this helps,
    >
    > CEF
    >
    > John wrote:

    >> Hi
    >>
    >> I am using below code to create an icon on desktop;
    >>
    >> dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
    >> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
    >> dstFolderFile = dstFolder & "\My App.exe"
    >>
    >> Set objShell = CreateObject("WScript.Shell")
    >> strFolder = objShell.SpecialFolders("AllUsersDesktop")
    >> Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
    >>
    >> link.Description = "My App"
    >> link.TargetPath = dstFolderFile
    >> link.WorkingDirectory = dstFolder
    >> link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
    >> link.Save
    >>
    >> Problem is I am getting the belwo error on line 'link.SetIconLocation
    >> "C:\Windows\System32\SHELL32.dll", 13';
    >>
    >> Error: Object doesn't support this property or method:
    >> 'link.SetIconLocation'
    >>
    >> What is the problem and how can I fix it?
    >>
    >> Thanks
    >>
    >> Regards


      My System SpecsSystem Spec

  4. #4


    T Lavedas Guest

    Re: Error setting shortcut icon

    On Mar 12, 8:52*am, "John" <i...@xxxxxx> wrote:

    > Hi
    >
    > Thanks. I have tried
    >
    > link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
    >
    > but still same error "Object doesn't support this property or method:
    > 'link.SetIconLocation'". If I rem out this line then shortcut is created
    > fine on the desktop.
    >
    > Thanks
    >
    > Regards
    >
    > "Charles E Finkenbiner" <CharlesEF_@_CEF-Inc.Com> wrote in messagenews:usy2cTtoJHA.3332@xxxxxx
    >

    > > Hi John,
    >

    > > I see 2 errors in your line of code. *You posted this line as your
    > > problem:
    >

    > > 'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'
    >

    > > The 2 errors I see are that you left out the = sign and you have your
    > > closing double-quote in the wrong place. The correct code should be:
    >

    > > link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
    >

    > > Hope this helps,
    >

    > > CEF
    >

    > > John wrote:

    > >> Hi
    >

    > >> I am using below code to create an icon on desktop;
    >

    > >> * dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "."&
    > >> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
    > >> * dstFolderFile = dstFolder & "\My App.exe"
    >

    > >> * Set objShell = CreateObject("WScript.Shell")
    > >> * strFolder = objShell.SpecialFolders("AllUsersDesktop")
    > >> * Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
    >

    > >> * link.Description = "My App"
    > >> * link.TargetPath = dstFolderFile
    > >> * link.WorkingDirectory = dstFolder
    > >> * link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
    > >> * link.Save
    >

    > >> Problem is I am getting the belwo error on line 'link.SetIconLocation
    > >> "C:\Windows\System32\SHELL32.dll", 13';
    >

    > >> Error: Object doesn't support this property or method:
    > >> 'link.SetIconLocation'
    >

    > >> What is the problem and how can I fix it?
    >

    > >> Thanks
    >

    > >> Regards
    The correct syntax is ...

    link.IconLocation = "C:\Windows\System32\SHELL32.dll, 13"

    See WSH 5.6 documentation download (URL all one line)
    http://www.microsoft.com/downloads/d...displaylang=en

    Tom Lavedas
    ***********
    http://there.is.no.more/tglbatch/

      My System SpecsSystem Spec

  5. #5


    Charles E Finkenbiner Guest

    Re: Error setting shortcut icon

    Hi John,

    Tom's post below is correct. I missed the 3rd error in your code. Tom
    caught it.


    Hope this helps,

    CEF

    John wrote:

    > Hi
    >
    > Thanks. I have tried
    >
    > link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
    >
    > but still same error "Object doesn't support this property or method:
    > 'link.SetIconLocation'". If I rem out this line then shortcut is created
    > fine on the desktop.
    >
    > Thanks
    >
    > Regards
    >
    > "Charles E Finkenbiner" <CharlesEF_@_CEF-Inc.Com> wrote in message
    > news:usy2cTtoJHA.3332@xxxxxx

    >> Hi John,
    >>
    >> I see 2 errors in your line of code. You posted this line as your
    >> problem:
    >>
    >> 'link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13'
    >>
    >> The 2 errors I see are that you left out the = sign and you have your
    >> closing double-quote in the wrong place. The correct code should be:
    >>
    >> link.SetIconLocation = "C:\Windows\System32\SHELL32.dll, 13"
    >>
    >>
    >> Hope this helps,
    >>
    >> CEF
    >>
    >> John wrote:

    >>> Hi
    >>>
    >>> I am using below code to create an icon on desktop;
    >>>
    >>> dstFolder = "C:\My App " & Mid(FormatDateTime(date,0),7,4) & "." &
    >>> Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
    >>> dstFolderFile = dstFolder & "\My App.exe"
    >>>
    >>> Set objShell = CreateObject("WScript.Shell")
    >>> strFolder = objShell.SpecialFolders("AllUsersDesktop")
    >>> Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
    >>>
    >>> link.Description = "My App"
    >>> link.TargetPath = dstFolderFile
    >>> link.WorkingDirectory = dstFolder
    >>> link.SetIconLocation "C:\Windows\System32\SHELL32.dll", 13
    >>> link.Save
    >>>
    >>> Problem is I am getting the belwo error on line 'link.SetIconLocation
    >>> "C:\Windows\System32\SHELL32.dll", 13';
    >>>
    >>> Error: Object doesn't support this property or method:
    >>> 'link.SetIconLocation'
    >>>
    >>> What is the problem and how can I fix it?
    >>>
    >>> Thanks
    >>>
    >>> Regards
    >
    >

      My System SpecsSystem Spec

Error setting shortcut icon problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
security icon over program icon/shortcut farmersam Vista security 1 01 Oct 2008
Shortcut Icon Froggie52 Vista General 1 28 Jun 2008
Shortcut Icon KingJ50 General Discussion 1 02 Apr 2008
File Icon Removal (Not a Shortcut Icon) CWLee Vista General 3 05 Feb 2008
Shortcut icon error DavidT Vista installation & setup 0 31 Jan 2007