Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Problem with Application.DisplayFormulaBar

  Asked By: Ashan    Date: Feb 20    Category: MS Office    Views: 1102
  

I have a problem with Application.DisplayFormulaBar as though it will turn it
off, when set to False, it won't turn it on when set to True.

In the ThisWorkbook I have the following codes:

Private Sub Workbook_Open()
TILPAS_MENU
ThisWorkbook.Worksheets("Operatørark").CommandButton1.Visible = True
ThisWorkbook.Worksheets("Operatørark").CommandButton2.Visible = False
ThisWorkbook.Worksheets("Operatørark").CommandButton3.Visible = False
ThisWorkbook.Worksheets("Kvalitetskontrol").CommandButton3.Visible = True
ThisWorkbook.Worksheets("Kvalitetskontrol").CommandButton4.Visible = False
ThisWorkbook.Worksheets("Kvalitetskontrol").CommandButton5.Visible = False
ThisWorkbook.Worksheets("Operatørark").Label1.Caption = "Du er logget på som:
" & GetCurrentUserName
ThisWorkbook.Sheets("Operatørark").Activate
ThisWorkbook.Sheets("Operatørark").Range("A1").Select
ActiveWindow.Zoom = True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
IsClosed = True 'Closing so set to True
If Cancel = True Then IsClosed = False 'Changed their mind
NULSTIL_MENU
Application.ScreenUpdating = False
IsOpen = False
Application.ScreenUpdating = True
End Sub

In a Module I have TILPAS_MENU and NULSTIL_MENU as:

Sub TILPAS_MENU()
' TILPAS_MENU Makro
With ActiveWindow
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
End With
Application.DisplayFormulaBar = False
i = 0
Sheets("Opsamling").Range("C1:C50").Clear
On Error Resume Next
For Each Allbars In Application.CommandBars
If Allbars.Visible = True Then
i = i + 1
With Sheets("Opsamling")
.Cells(i, 3) = Allbars.Name
If Allbars.Name = "Worksheet Menu Bar" Then
Allbars.Enabled = False
Else
Allbars.Visible = False
End If
End With
End If
Next
On Error GoTo 0
End Sub

Sub NULSTIL_MENU()
' TILPAS_MENU Makro
With ActiveWindow
.DisplayHeadings = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With
Application.DisplayFormulaBar = True
On Error Resume Next
With Sheets("Opsamling")
For i = 1 To WorksheetFunction.CountA(.Columns(3))
BarName = .Cells(i, 3)
Application.CommandBars(BarName).Enabled = True
Application.CommandBars(BarName).Visible = True
Next i
i = 1
End With
On Error GoTo 0
Application.CommandBars("Worksheet menu bar").Enabled = True
End Sub

Everything works out fine except for Application.DisplayFormulaBar = True. It
won't show the formula bar.
If I go through the code manually (F8) it works !
Have tried several measures as DoEvents, Wait, ScreenUpdate ...

Any ideas??

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Problem with Application.DisplayFormulaBar Or get search suggestion and latest updates.