0

I turned off all of the elements when opening Excel. It makes it look like an application.

I have a button that opens a User Form. An apparent side-effect of that process is that the scroll bars reappear.

Can I stop that from happening or is that a function of Excel?

I tried the change event, but showing the user form does not trigger that event.

This hides the elements on individual sheets.

Sub HideWorksheetElements()
Dim State As Boolean

' Hide work sheet elements except while developing - reverse status     in Production
If Sheets("Lookups").Range("B6").value = "Production" Then
    State = False
Else
    State = True
End If

With ActiveWindow
    .DisplayGridlines = State
    .DisplayHorizontalScrollBar = State
    .DisplayVerticalScrollBar = State
    .DisplayHeadings = State
End With

End Sub

This hides the elements upon workbook opening:

Sub HideAll()

With ActiveWindow
    .DisplayHorizontalScrollBar = False
    .DisplayVerticalScrollBar = False
    .DisplayHeadings = False
    .DisplayWorkbookTabs = False     ' Change to False in Prouction
End With

With Application
    .DisplayStatusBar = False
    .DisplayFormulaBar = False
    .ExecuteExcel4Macro "show.toolbar(""Ribbon"",False)"
End With

End Sub

This calls the userform.

Private Sub UserForm_Initialize()
    Me.StartUpPosition = 0
    Me.Top = 125
    Me.Left = 400
End Sub
8
  • What scrollbars do you mean? Maybe show a picture. What have you all hided in the user-interface of Excel and how? Commented Aug 30 at 18:52
  • The horizontal and vertical scroll bars of each worksheet. I have a vba subroutine that runs when each sheet is activated via a button. It sets the height, width, top and left as well as hiding the scroll bars, tabs, headings, etc including both of the scroll bars. Commented Aug 30 at 22:33
  • I am unable to reproduce the issue. in my case the scrollbars remain invisible. Can you share your code? For both hiding the scrollbar and showing the userform. Commented Aug 30 at 22:39
  • Ok, I edited the question to include some vba that hides elements and one that calls the userform. Just to reiterate, if I comment out the userform call, everything works as expected. This is the only sheet that will have a userform popup over it so I don't want the scroll bars to reappear, no need for them. Commented Aug 30 at 23:09
  • Additionally, I am just testing the interface at this point - I have not done much coding on the application side of it. I know I probably could build a far more robust product using VB, C#, etc but I haven't worked with them in years. I work almost exclusively in Excel these days. Commented Aug 30 at 23:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.