PDA

View Full Version : Excel screen stretching



Ruckley
02-25-2010, 06:54 AM
I have a problem with a workbook I produced. It was crated in the English (UK) version of Excel. However, my Mexican and German colleagues both report screen stretching (i.e. the workbook expands and does not fit on the screen). Other workbooks I sent them are fine.

Does anybody have any idea what this might be?

lucas
02-25-2010, 07:46 AM
Any code in the workbook? In the thisworkbook module or any of the sheet modules?

Ruckley
02-25-2010, 08:52 AM
Yes. Lots. I'm wondering if it might be something to do with one of these commands:



Application.CommandBars.FindControl(ID:=30003).Delete
Application.CommandBars.FindControl(ID:=30004).Delete
Application.CommandBars.FindControl(ID:=30005).Delete
Application.CommandBars.FindControl(ID:=30006).Delete
Application.CommandBars.FindControl(ID:=30007).Delete
Application.CommandBars.FindControl(ID:=30011).Delete
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayWorkbookTabs = False
Application.DisplayAlerts = False


Edit: VBA tags added to code.

lucas
02-25-2010, 09:01 AM
Are they in the thisworkbook module and are there more commands? I don't see any there that would cause your problem.

Post the workbook open code.

Hint, when posting code, select the code and hit the green vba button to format it for the forum as I have done to your code in post #3

Ruckley
02-25-2010, 10:11 AM
Well, this is a cut and paste from the thisworkbook module:


Dim close_flag As Boolean

Private Sub Workbook_Activate()
Call menu_create
Call unprotect_sheet
Call hide_everything
Call show_everything
Application.ScreenUpdating = False
Call excel_version
Call protect_sheet
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False
close_flag = True
Application.ScreenUpdating = False
End Sub

Private Sub Workbook_Deactivate()
If close_flag = True Then
menu_delete
Else
menu_delete
Call show_everything
Application.ScreenUpdating = True
End If
End Sub

Private Sub Workbook_Open()
close_flag = False
Worksheets("Top").Activate
Call unprotect_sheet
'Call menu_create
Range("A1").Select
Call protect_sheet
Application.ScreenUpdating = False
Call excel_version
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

If activate_flag <> True Then
Call unprotect_sheet
ActiveWindow.DisplayHeadings = False
Call protect_sheet
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False

End If
End Sub

Public Sub hide_everything()

'disable these before finishing
Application.AutoRecover.Enabled = False
Application.CommandBars("Borders").Visible = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Drawing").Visible = False
' Application.CommandBars(1).Controls("edit").Delete
' Application.CommandBars(1).Controls("view").Delete
' Application.CommandBars(1).Controls("insert").Delete
' Application.CommandBars(1).Controls("format").Delete
' Application.CommandBars(1).Controls("tools").Delete
' Application.CommandBars(1).Controls("data").Delete
Application.CommandBars.FindControl(ID:=30003).Delete
Application.CommandBars.FindControl(ID:=30004).Delete
Application.CommandBars.FindControl(ID:=30005).Delete
Application.CommandBars.FindControl(ID:=30006).Delete
Application.CommandBars.FindControl(ID:=30007).Delete
Application.CommandBars.FindControl(ID:=30011).Delete
Application.DisplayFormulaBar = False
Application.DisplayStatusBar = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayWorkbookTabs = False
Application.DisplayAlerts = False
'ActiveWorkbook.Close True ' closes the active workbook and saves any changes
End Sub

Public Sub show_everything()
Application.AutoRecover.Enabled = True
'Application.CommandBars("Borders").Visible = True
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Formatting").Visible = True
Application.CommandBars("Control Toolbox").Visible = True
Application.CommandBars(1).Reset
Application.DisplayFormulaBar = True
Application.DisplayStatusBar = True
ActiveWindow.DisplayHeadings = True
ActiveWindow.DisplayWorkbookTabs = True
'Call menu_create

End Sub

Public Sub excel_version()

Dim oApp As Object
Dim sVersion As String
Set oApp = GetObject(, "Excel.Application")
If TypeName(oApp) = "Nothing" Then
Set oApp = CreateObject("Excel.Application")
End If
Select Case Left$(oApp.Version, InStr(1, oApp.Version, ".") + 1)
Case "8.0"
sVersion = "97"
MsgBox "Excel version too old. You need 2003 or newer"
Workbooks("CCalc_PVC").Close
Case "9.0"
sVersion = "2000"
MsgBox "Excel version too old. You need 2003 or newer"
Workbooks("CCalc_PVC").Close
Case "10.0"
sVersion = "2002"
MsgBox "Excel version too old. You need 2003 or newer"
Workbooks("CCalc_PVC").Close
Case "11.0"
sVersion = "2003"
'MsgBox "Excel version: " & sVersion
Case "12.0"
sVersion = "2007"
'MsgBox "Excel version: " & sVersion
Call v_2007_updates
Case Else
sVersion = "Too Old!"
MsgBox "Excel version: " & sVersion & " the code will not work in this version"
Workbooks("CCalc_PVC").Close
End Select

End Sub

Public Sub v_2007_updates()

End Sub