+ Reply to Thread
Results 1 to 11 of 11

Creating a shortcut of a file in a folder through excel vba

  1. #1
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Creating a shortcut of a file in a folder through excel vba

    Hi,

    I am continuing someone else's work and I am finding that a piece of code that is supposed to create a windows shortcut of a file in a certain folder produces a run-time error -2147024893(80070003) (Method 'Save' of object 'IWshShortCut' failed)

    the sub that produces the error is the following

    Please Login or Register  to view this content.
    any idea of what might be going wrong or what should I check?
    thanks!

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Creating a shortcut of a file in a folder through excel vba

    Can you manually create a shortcut in the target folder using the specified arguments?
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Creating a shortcut of a file in a folder through excel vba

    Did you check the arguments' values ?

    Please Login or Register  to view this content.



  4. #4
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: Creating a shortcut of a file in a folder through excel vba

    thanks ! I managed and when I foudn out I could create the shortcut then the macro also could... still misterious but we'll leave it until it gives further problems!

    thanks a lot

  5. #5
    Registered User
    Join Date
    03-22-2012
    Location
    canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Creating a shortcut of a file in a folder through excel vba

    How would you define the path to make Excel 2013 start in a new instance?

    I am failing to apply :
    .TargetPath = Application.Path & thisworkbook.path

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Creating a shortcut of a file in a folder through excel vba

    w2w2w2 welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    02-27-2020
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    5

    Re: Creating a shortcut of a file in a folder through excel vba

    It looks like my problem. When my macro should starts to create first shourtcut I've recieved an error:
    run-time error -2147024893(80070003) (Method 'Save' of object 'IWshShortCut' failed)

    Please Login or Register  to view this content.
    I am supprised because it was warking until last week. Suddenly it stops without changing anything in code.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: Creating a shortcut of a file in a folder through excel vba

    I find it hard to believe this part ever worked:

    Please Login or Register  to view this content.
    Rory

  9. #9
    Registered User
    Join Date
    02-27-2020
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    5

    Re: Creating a shortcut of a file in a folder through excel vba

    sorry
    Here is correct code:
    Please Login or Register  to view this content.

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,908

    Re: Creating a shortcut of a file in a folder through excel vba

    If the code is unchanged, then the most likely cause is a change in the data on the sheet, or the drive/folder structures. I suggest you verify the relevant values when the error occurs.

  11. #11
    Registered User
    Join Date
    02-27-2020
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    5

    Re: Creating a shortcut of a file in a folder through excel vba

    You are right
    Wrong path. I have thought that if there are any mistakes in paths it will give me an information e.g. 'I row 891 is problem'...
    Thank you! SOLVED

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1