+ Reply to Thread
Results 1 to 15 of 15

Want to have Windows Photo Viewerto open a file

  1. #1
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Want to have Windows Photo Viewerto open a file

    Hello,
    Below sub is run by a CommandButton that sits on a UserForm.

    Please Login or Register  to view this content.
    This opens a picture using a link that is stored in Cell(MyLine, MyPic) in default Internet Explorer since I am having XL2013.
    Previously it opened the picture with some photo viewer.
    It is disadvantageous to have the picture opened in IE, because usually there are more pics in the target folder and IE does not have the option of viewing the next pic on a click.

    Therefore my question is: How can I force the application to open the linked picture using Win Photo Viewer and not the default IE?

    Thanks for your attention
    Regards,

    Gabor

    Protect trees.. maybe one day we need to climb back....

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: Want to have Windows Photo Viewerto open a file

    Maybe use Shell instead of following the hyperlink. See:

    http://windowssecrets.com/forums/sho...and-Fax-Viewer


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Want to have Windows Photo Viewerto open a file

    Tried, doesn't work.
    Do I need any more that just to add the line in the macro?
    Please Login or Register  to view this content.
    Thanks

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: Want to have Windows Photo Viewerto open a file

    Well, it's an old post and an old version of Windows so you you probably need to check what you have on your system.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this !

    Quote Originally Posted by Gabor View Post
    Therefore my question is: How can I force the application to open the linked picture using Win Photo Viewer and not the default IE?
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Want to have Windows Photo Viewerto open a file

    Hi Marc L,
    Anything to be set specifically before running this code?
    I get: Compile error: 'Variable not defined for oWShell

    Thx.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Re: Want to have Windows Photo Viewerto open a file


    It's a part after your code, the MyPathAndName variable must be initialized !

    This is a hint to open a document with the default application in Windows;
    works like a charm on computers with different Excel versions …
    Last edited by Marc L; 12-09-2013 at 12:27 PM.

  8. #8
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Want to have Windows Photo Viewerto open a file

    My code is fine withthe MyPathAndName variable.
    It gets stuck on the oWShell.
    Also, I cannot find oWShell in the Help.
    Is this a variable, or a Function?

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Want to have Windows Photo Viewerto open a file


    How could it be a function with statement Set ?!

  10. #10
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Want to have Windows Photo Viewerto open a file

    I get: Run-time error
    'Method 'Run' of Object 'IWshShell3' failed'
    Any idea what this might be?

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Want to have Windows Photo Viewerto open a file


    Don't know … Maybe your Windows has no WScript library or is protected against for some security reason …

    Or it's normal if it's an Office 2010 "Starter", have to install a complete version …
    If it's a normal version, try to repair it …

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: Want to have Windows Photo Viewerto open a file

    The original link was OK, it just had a space where a space shouldn't have been.

    http://windowssecrets.com/forums/sho...and-Fax-Viewer

    Please Login or Register  to view this content.

    Regards, TMS

  13. #13
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Want to have Windows Photo Viewerto open a file

    Now it works fine.
    Thank you.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: Want to have Windows Photo Viewerto open a file

    You're welcome.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: Want to have Windows Photo Viewerto open a file

    Thanks again for the rep ... some rep power !

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Save Image from open Windows Photo Viewer
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-04-2013, 12:53 PM
  2. Replies: 1
    Last Post: 05-24-2013, 01:35 PM
  3. Replies: 1
    Last Post: 08-05-2006, 04:59 PM
  4. [SOLVED] Open email windows can't open, excel shreadsheet file .xls ?
    By skiz in forum Excel General
    Replies: 0
    Last Post: 10-02-2005, 03:05 PM
  5. Open File or Switch Between Windows if File is Open
    By Ricky Pang in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-08-2005, 01:05 AM

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