+ Reply to Thread
Results 1 to 6 of 6

Code Error when another Excel document is open

  1. #1
    Registered User
    Join Date
    08-15-2017
    Location
    Isle of Man
    MS-Off Ver
    7.0
    Posts
    25

    Code Error when another Excel document is open

    Evening all,

    The below code keeps breaking at the first line. I don't have the issue when on my PC but when passed to users, who have other excel documents it throws an error all the time. I have tried having other documents open but cannot replicate.

    StrName is just looking to land them back on the right tab based on the day in F2 ( Monday to Friday ) matching tab names.

    The issue I also have is that I struggle to know how to call the actual workbook (Which I thought might stop the issue) as it could be 'Week 1' 'Week 2' ........ 'Week 5'. This is consistent though so naming convention wont change.


    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Code Error when another Excel document is open

    Hi,

    What is the error message that the users get when the macro fails on the first instruction?

    At that point what is in F2 on the sheet called data?

    Upload the workbook so that we can see if we encounter the same problem.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-15-2017
    Location
    Isle of Man
    MS-Off Ver
    7.0
    Posts
    25

    Re: Code Error when another Excel document is open

    Hi Richard,

    Thank you for looking over.

    As the spreadsheet relates to my work I would struggle to put in onto here, redacting it would probably mean it doesn't work

    F2 contains
    Please Login or Register  to view this content.
    in order that at the end I can drop the user back to the tab that relates to the right day.

    I think it has to with other sheets being open and therefore it cant find F2 on that tab as it wont exist on the other file they look at !?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Code Error when another Excel document is open

    Hi,

    You could skip the cell reference altogether and use
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Code Error when another Excel document is open

    Are you running the macro in one workbook and wanting to be taken to the daily sheet in another workbook?

    In which case you need to tell the macro the name of the other workbook and then Activate that workbook and go to the daily sheet.

  6. #6
    Registered User
    Join Date
    08-15-2017
    Location
    Isle of Man
    MS-Off Ver
    7.0
    Posts
    25

    Re: Code Error when another Excel document is open

    This seems to have sorted it, Thank you for your help !

    Quote Originally Posted by xlnitwit View Post
    Hi,

    You could skip the cell reference altogether and use
    Please Login or Register  to view this content.

+ 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. VB Code for Open Office Document
    By rizmomin in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2013, 07:26 AM
  2. open excel source document in background when i open word document
    By hootiebsc in forum Word Programming / VBA / Macros
    Replies: 5
    Last Post: 03-22-2013, 07:50 PM
  3. Prevent code from running on another open document
    By Marco-Kun in forum Word Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2012, 01:39 AM
  4. runtime error recived for some trying to open document
    By webguync in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2009, 05:29 PM
  5. Replies: 1
    Last Post: 01-21-2008, 08:07 PM
  6. open document code
    By yhlin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2007, 03:49 PM
  7. Replies: 1
    Last Post: 06-05-2006, 08:20 AM
  8. i cannot open excel file error Cannot access read-only document me
    By Lenda. in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-14-2005, 03:06 PM

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