Solved

Excel Add-in VB.net - determine if active workbook has macros

Posted on 2012-12-30
4
546 Views
Last Modified: 2012-12-30
Hi

I have quite a complicated add-in the causes strange errors if i open Excel by opening
a .xlsm file. I need to determine if the ActiveWorkbook is a .xlsm file.
How do I do this?

    Private Sub ThisAddIn_Startup() Handles Me.Startup

        If Globals.ThisAddIn.Application.ActiveWorkbook.FileFormat.ToString <> "52" Then
            oAddInStartUp()
        End If

    End Sub
0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38731496
What happens with above code?
0
 

Author Comment

by:murbro
ID: 38731512
If it is a .xlsm it doesn't load my add-in. I have to go into the Option Add-ins section and select COM Add-ins then re-check the box to make it available as the system unchecks this.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 38731542
Is that not the desired outcome. You have a condition which checks that the file is not xlsm before calling startup function.
0
 

Author Closing Comment

by:murbro
ID: 38732074
Yes. Agreed
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question