+ Reply to Thread
Results 1 to 8 of 8

Prevent workbook from opening if required Add-in is not installed

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Office2011 (Mac)
    Posts
    16

    Prevent workbook from opening if required Add-in is not installed

    I am looking to either prevent a workbook from opening, or forcing a close, if a required add-in is not installed on the user's computer. I have a series of workbooks that contain data, and all their functionality is controlled from an add-in.

    I have tried to place the following code in several different routines, including Workbook_Open, Workbook_Activate, and in other modules where it is triggered by an event or command button. I continually get a run-time error 1004 when it tries to close the workbook. The following code does a good job of recognizing when the add-in is installed or not. The trouble I am having is focused solely on forcing a close.

    Please Login or Register  to view this content.
    Instead of ActiveWorkbook.Close I have also tried ThisWorkbook.Close with the same results.

    Does anybody have some insight on this? Or previous experience to share? Or other techniques to consider for disabling the file?

    Thanks!

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Prevent workbook from opening if required Add-in is not installed

    Would this work for you?

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Prevent workbook from opening if required Add-in is not installed

    The reason is that you will get an error if the add-in is not available to the user, and not with the line to close the workbook.

  4. #4
    Registered User
    Join Date
    08-16-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Office2011 (Mac)
    Posts
    16

    Re: Prevent workbook from opening if required Add-in is not installed

    Thank you for the response. I just tried the method you suggested, and it produced the same result of a run-time 1004 error. (Method 'Close' of object '_Workbook' Failed)

  5. #5
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Prevent workbook from opening if required Add-in is not installed

    Alright, but for me it worked just fine...

  6. #6
    Registered User
    Join Date
    08-16-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Office2011 (Mac)
    Posts
    16

    Re: Prevent workbook from opening if required Add-in is not installed

    I have placed your code in an empty workbook with no other closing routines, etc, and it works great. I must have a conflict somewhere in the Workbook_Close event.

  7. #7
    Registered User
    Join Date
    08-16-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Office2011 (Mac)
    Posts
    16

    Re: Prevent workbook from opening if required Add-in is not installed

    Yes, I found the problem. It was a conflict with a Workbook_Deactivate item. Works beautifully now. Thank you!!

  8. #8
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Prevent workbook from opening if required Add-in is not installed

    You're welcome, glad it works

+ 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] Can I prevent a worksheet from opening to various users within a workbook?
    By maryren in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-24-2015, 05:30 AM
  2. Replies: 2
    Last Post: 08-21-2013, 10:00 AM
  3. prevent new workbooks from opening in avtive workbook
    By mkalenuik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2011, 12:13 PM
  4. Prevent update of links, when opening a workbook
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2010, 12:39 PM
  5. Prevent excel from Opening with a new workbook
    By jerrydixon in forum Excel General
    Replies: 1
    Last Post: 08-14-2008, 03:24 PM

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