cll
04-24-2008, 08:43 AM
Hi all.
I have a problem with the Application.DisplayFormulaBar.
Having the following code:
Sub TILPAS_MENU()
Dim i As Integer
Dim AllBars As CommandBar
'
' 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()
Dim i As Integer
Dim BarName As String
'
' TILPAS_MENU Makro
'
With ActiveWindow
.DisplayHeadings = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With
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
Application.DisplayFormulaBar = True
End Sub
which I respectively called from Open and BeforeClose events to hide and display Toolbars etc. Initial setting is stored in a sheet called "Opsamling".
All works fine except:
Application.DisplayFormulaBar = True
The formulabar won't show. If I run the code manually with F8 the formulabar will show. But I want to run it from a button in the sheet that closes the workbook.
I've tried a lot of things as setting Application.ScreenUpdating = True, pausing the macro for some seconds, putting Application.DisplayFormulaBar = True in a separate Sub or in the event, call it twice etc.
Any Ideas
Regards
Claus
I have a problem with the Application.DisplayFormulaBar.
Having the following code:
Sub TILPAS_MENU()
Dim i As Integer
Dim AllBars As CommandBar
'
' 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()
Dim i As Integer
Dim BarName As String
'
' TILPAS_MENU Makro
'
With ActiveWindow
.DisplayHeadings = True
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With
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
Application.DisplayFormulaBar = True
End Sub
which I respectively called from Open and BeforeClose events to hide and display Toolbars etc. Initial setting is stored in a sheet called "Opsamling".
All works fine except:
Application.DisplayFormulaBar = True
The formulabar won't show. If I run the code manually with F8 the formulabar will show. But I want to run it from a button in the sheet that closes the workbook.
I've tried a lot of things as setting Application.ScreenUpdating = True, pausing the macro for some seconds, putting Application.DisplayFormulaBar = True in a separate Sub or in the event, call it twice etc.
Any Ideas
Regards
Claus