Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' >>>>>>>>>>> MStandardCode <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- ' Description: Contains standard code library routines that are used
- ' without modification in many different projects.
- '
- ' Authors: Rob Bovey, www.appspro.com
- ' Stephen Bullen, www.oaltd.co.uk
- '
- ' Chapter Change Overview
- ' Ch# Comment
- ' --------------------------------------------------------------
- ' 05 Initial version
- '
- Option Explicit
- Option Private Module
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Comments: Called by all entry point procedures before exiting
- ' to ensure that all application properties are
- ' correctly restored.
- '
- ' Arguments: None
- '
- ' Date Developer Chap Action
- ' --------------------------------------------------------------
- ' 06/01/08 Rob Bovey Ch05 Initial version
- '
- Public Sub ResetAppProperties()
- Application.StatusBar = False
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- Application.EnableEvents = True
- Application.EnableCancelKey = xlInterrupt
- Application.Cursor = xlDefault
- End Sub
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Comments: Obtains the sheet tab name of a worksheet from its
- ' code name.
- '
- ' Arguments: wkbProject The project workbook to look in.
- ' sCodeName The CodeName of the worksheet whose
- ' sheet tab name you want.
- '
- ' Returns: String The sheet tab name corresponding to sCodeName.
- '
- ' Date Developer Chap Action
- ' --------------------------------------------------------------
- ' 06/01/08 Rob Bovey Ch05 Initial version
- '
- Public Function sSheetTabName(ByRef wkbProject As Workbook, _
- ByRef sCodeName As String) As String
- Dim wksSheet As Worksheet
- For Each wksSheet In wkbProject.Worksheets
- If wksSheet.CodeName = sCodeName Then
- sSheetTabName = wksSheet.Name
- Exit For
- End If
- Next wksSheet
- End Function
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Comments: This method determines if any visible workbooks are
- ' currently open in Excel. This is required so that
- ' we don't bomb on machines using personal.xls or a
- ' similar hidden workbook.
- '
- ' Arguments: None
- '
- ' Returns: Long The number of visible workbooks
- ' currently open in Excel.
- '
- ' Date Developer Chap Action
- ' --------------------------------------------------------------
- ' 06/01/08 Rob Bovey Ch05 Initial version
- '
- Public Function lCountVisibleWorkbooks() As Long
- Dim lCount As Long
- Dim wkbBook As Workbook
- For Each wkbBook In Application.Workbooks
- If wkbBook.Windows(1).Visible Then
- lCount = lCount + 1
- End If
- Next wkbBook
- lCountVisibleWorkbooks = lCount
- End Function
Advertisement
Add Comment
Please, Sign In to add comment