Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:49:18+00:00 2026-06-05T22:49:18+00:00

I have a template with macros to validate the data on clicking the button.

  • 0

I have a template with macros to validate the data on clicking the button. The template having only one sheet and no sheets added in that file (It should have one sheet only). Now, I have to do is, when the file is open without macros enabled, i need to display a image, please enable macros other wise no need to display.

Thanks a lot in advance for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:49:20+00:00Added an answer on June 5, 2026 at 10:49 pm

    how to force user to enable macros in the sheet?

    The answer to your question is “You Can’t“

    However here is an alternative by Ken Puls which will suit your purpose just fine.

    Topic: Force users to enable macros in a workbook

    Link: http://www.vbaexpress.com/kb/getarticle.php?kb_id=379

    QUOTE FROM THAT LINK

    Since there is no way to use a macro to turn on macros, a technique to ensure the user has enabled macros is desirable. This particular method hides all sheets except a “welcome” sheet which tells the user to enable macros, and is enforced every time the workbook is saved. If the user opens the workbook with macros enabled, the sheets will all be unhidden by the macro. The hiding of sheets is also done using Excel VeryHidden property, which means that the sheets cannot be unhidden using Excel’s menus. Keep in mind, however, that this only affects this workbook, so a user could use a macro from another workbook to unhide all of your sheets. Chances are, however, if your user is that skilled, they can always get into your file anyway. NOTE: To prevent some event looping issues, this code requires overruling Excel’s built in Save events, and also requires replicating Excel’s “Workbook has changed, do you want to save” prompts and actions. This code takes care of all of it. It does, however, create a very minor issue when closing the file. If the user trys to quit the application, it will close the workbook, but not Excel. Quitting again will close Excel completely.

    FOLLOWUP

    Before you close the Workbook do the following

    1. Insert a new Row
    2. Increase the height of the row
    3. Hide the rest of the rows
    4. Resize and Move picture at a relevant location

    And when you open do the reverse of above

    1. Unhide the rest of the rows
    2. Delete the 1st Row
    3. Decrease the size and Move the picture to a far left location in the sheet

    Important.

    When you place the picture on the sheet, right click on the picture and click on ‘Format Picture’. In the Format Picture Dialog, select Don't move or size with cells and uncheck the option which says Print Object

    enter image description here

    CODE WHEN CLOSING THE WORKBOOK – Apply the same concept as shown in the above link

    Dim shp As Shape
    
    With Sheets("Sheet1")
        .Rows(1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        .Rows(1).RowHeight = 300
    
        .Rows("2:" & .Rows.Count).EntireRow.Hidden = True
        Set shp = .Shapes("Picture 1")
        With shp
            .Top = Sheets("Sheet1").Range("A1").Top
            .Left = Sheets("Sheet1").Range("A1").Left
            .LockAspectRatio = msoFalse
            .Height = 100
            .Width = 100
        End With
    End With
    

    CODE WHEN OPENING THE WORKBOOK – Apply the same concept as shown in the above link

    Dim shp As Shape
    
    With Sheets("Sheet1")
        .Rows("1:" & .Rows.Count).EntireRow.Hidden = False
        .Rows(1).Delete
    
        Set shp = .Shapes("Picture 1")
        With shp
            .LockAspectRatio = msoFalse
            .Height = 0
            .Width = 0
            .Top = Sheets("Sheet1").Range("A1").Top
            .Left = Sheets("Sheet1").Range("IV1").Left
        End With
    End With
    

    NOTE: In the above code, replace "Sheet1" with the relevant sheet name and replace "Picture 1" with the relevant picture name. I am showing the image in Cell A1. You can amend that to display the picture where ever you want by adjusting .Top and .Left of the Shape.

    SNAPSHOT IF MACRO IS DISABLED

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel template that uses a macro to save the file, so
Good Afternoon, I have a an Excel template file - which contains Macros -
I have template that looks like this: 100 template<size_t A0, size_t A1, size_t A2,
I have template in which a button is created with a link using css,
I have a template file in a folder c:\template_folder. At runtime, I will create
I have a template set up that I'm making ajax calls to via jQuery.
I have a macro that creates a new document based on a template stored
We have a C++ template library that has some features that depend on zlib,
I have a macro enabled template with an event listener that listens for content
I have an .xltm template spreadsheet that I'm wondering if I can get a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.