| 416-621-9348 cgreaves@chrisgreaves.com | |
|---|---|
| Home Services Products |
| Best Fit Algorithm (Home) | The Macro | Building The Data Array | Printing The Best Fit Results | A Typical Data Table | Results Of Best Fit |
|---|
The Macro
Public Sub BestFitVCRTapes()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Function: BestFitVCRTapes
'''
''' Comments: Arrange our VCR tapes for best fit on fixed-length DVDs.
'''
''' Arguments: None.
'''
''' Returns: None
'''
''' Date Developer Action
''' --------------------------------------------------------------------------
''' 2009/05/04 Chris Greaves Cloned from Under.BestFitToolbars
'''
Call Statistics("BestFitVCRTapes")
''' Obtain a useful value for DVD length in minutes
Dim lngBucketSize As Long
lngBucketSize = 6 * 60 + 5 ' 6 hrs 5 minutes
''' Obtain details of a set of VCR tapes.
Dim lngMaxRowIndex As Long ' the maximum row index in the set
Dim lngItemList()
ReDim lngItemList(intcCBCols, 0) ' Index, Width, Row
Call GetVCRArray(ActiveDocument, lngItemList, lngMaxRowIndex)
''' Process any VCR tape data found
If UBound(lngItemList, 2) > 0 Then ' we found some cb
ReDim Preserve lngItemList(UBound(lngItemList, 1), UBound(lngItemList, 2) - 1)
lngMaxRowIndex = lngMaxRowIndex + 1
''' Assign new positions to all command bars that can afford to share a row.
Call FitLessThanBuffer(lngItemList, lngBucketSize, lngMaxRowIndex)
''' Assign new positions to all command bars that won't even fit on a row by themselves.
Call FitGreaterThanBuffer(lngItemList, lngBucketSize, lngMaxRowIndex)
''' Now use the adjusted RowIndex settings to re-place the toolbars
Call PlaceVCRs(ActiveDocument, lngItemList, lngBucketSize)
Else ' no cb found
End If
End Sub
Loading
Toronto and Mississauga, Friday, December 03, 2010 8:39 AM
Copyright © 1996-2010 Chris Greaves. All Rights Reserved.