Forum Discussion

tgrondin's avatar
tgrondin
Copper Contributor
Jun 20, 2022
Solved

Excel vba buttons disappearing

Hi, I'm an other one who has a problem with disappearing buttons. I'm using a macro enabled excel file as a template for another software (Altium). When I generate the new file my two buttons disappear but the VBA codes behind them still exist. The only "fix" I found was to add two new buttons that do nothing. My first ones then appear but not the last two ones. It looks like it never shows the last two ones no matter what I do. I also tried going to the advanced options with show all, but it did nothing.

 

Does someone know what could cause this?

 

Thanks

  • tgrondin 

    Once I noticed that toggling between views made my buttons appear, I solved this problem by adding a page view instruction to a worksheet change code I was already running.  If you aren't running a worksheet change code, you can still add one to target any cell(s) that user must change (in my case, user must input a number to proceed).  If that's not an option, you can create a workbook open event that changes a cell (i.e. inserts date) 10 seconds after the workbook opens.  

     

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error Resume Next

    Application.EnableEvents = False

    Dim rng As Range
    Set rng = Range("A9:A10009")

    If Not Intersect(Target, rng) Is Nothing Then
    Target.Value = UCase(Target.Value)
    ActiveWorkbook.Save
    ActiveWindow.View = xlPageLayoutView
    End If

    Application.EnableEvents = True

    End Sub

  • tgrondin 

    Once I noticed that toggling between views made my buttons appear, I solved this problem by adding a page view instruction to a worksheet change code I was already running.  If you aren't running a worksheet change code, you can still add one to target any cell(s) that user must change (in my case, user must input a number to proceed).  If that's not an option, you can create a workbook open event that changes a cell (i.e. inserts date) 10 seconds after the workbook opens.  

     

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error Resume Next

    Application.EnableEvents = False

    Dim rng As Range
    Set rng = Range("A9:A10009")

    If Not Intersect(Target, rng) Is Nothing Then
    Target.Value = UCase(Target.Value)
    ActiveWorkbook.Save
    ActiveWindow.View = xlPageLayoutView
    End If

    Application.EnableEvents = True

    End Sub

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor
    As far as I know, if the file is opened with Excel Online in Sharepoint (or OneDrive) and then saved, all macro buttons disappear when opened with Excel with a permanent license, such as Excel 2016.
    Maybe this information will help you...if not, just ignore it.

Resources