+ Reply to Thread
Results 1 to 7 of 7

Well working simple macro now not working-open folder

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Well working simple macro now not working-open folder

    I have similar macros in both Word and Excel. Their purpose is to open the folder the currently active document is in. We've recently switched from a Desktop to a Laptop, so I'm going through and testing things, and I've found that this one doesn't work correctly now in Word, but works fine in Excel. For Excel it opens the folder the WB is in, but for Word it opens the "My Documents" folder. I'm stumped as to why. Any ideas?

    BTW, if I Debug.print ActiveDocument.Path it prints out
    "H:\How to\Excel\Workbooks, Worksheets, Ranges", but the OpenFolder macro opens "My Documents"

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by jomili; 06-30-2017 at 02:49 PM. Reason: More info
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  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,433

    Re: Well working simple macro now not working-open folder

    Maybe comment out the error trap and see how it fails, assuming it fails.
    .
    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
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Well working simple macro now not working-open folder

    It didn't error, just opened the wrong folder again. I've noticed that this failure isn't total. "Some" documents (.DOCX) the macro works on, "some" it doesn't. Trying to see if I can spot a difference. For instance, two .DOCX documents in the same folder. If I have one of them open, the macro works fine. If instead I have the other open, it doesn't. Crazy!

  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,433

    Re: Well working simple macro now not working-open folder

    Perhaps you should use ThisWorkbook and ThisDocument rather than ActiveWorkbook and ActiveDocument.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Well working simple macro now not working-open folder

    The macro doesn't exist in the workbook, it's for global use. So for Excel it's in my Personal, for Word it's in my Normal.

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Well working simple macro now not working-open folder

    Your Word macro works fine for me. Perhaps you were testing it with an unsaved document?
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Well working simple macro now not working-open folder

    Perhaps, but no. When I originally noticed the problem I had just created a document ("Range_Last Row.docx") and saved it, then tried to use my macro to open the folder it was in and landed on "MyDocuments". I tried a few other DOCXs in various folders, and on about half the macro worked fine, on the rest it opened "MyDocuments". Just now I reopened "Range_Last Row.docx", and again the macro defaulted to "MyDocuments".

+ 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. [SOLVED] open all files in a folder code not working
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2015, 03:53 PM
  2. [SOLVED] Excel 2010 VB macro to open all files in folder and run a simple macro
    By MSFLNA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2013, 02:54 PM
  3. [SOLVED] Why is my Simple Recorded Macro not working?
    By andrew93hughes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-27-2013, 08:49 AM
  4. Simple concatenation in macro not working...
    By cboshdave in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 11:11 PM
  5. [VBA] Simple Formatting Macro not working?
    By D00kie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2011, 06:31 PM
  6. Why isn't this simple macro working?
    By larryg003 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2010, 05:44 PM
  7. simple macro only working..sometimes
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2010, 09:38 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