Results 1 to 10 of 40

Thread: test BB Code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,316
    Rep Power
    10
    Some required Functions




    PHP Code:
    Private Function objColour(strCell As String) As String
        objColour 
    "#" Right(Right("000000" Hex(strCell), 6), 2) & Mid(Right("000000" Hex(strCell), 6), 32) & Left(Right("000000" Hex(strCell), 6), 2)
    End Function
     
    Private Function 
    FontAlignment(ByVal objCell As Object) As String
        With objCell
            Select 
    Case .HorizontalAlignment
            
    Case xlLeft
                FontAlignment 
    "LEFT"
            
    Case xlRight
                FontAlignment 
    "RIGHT"
            
    Case xlCenter
                FontAlignment 
    "CENTER"
            
    Case Else
                
    Select Case VarType(.Value2)
                Case 
    8
                    FontAlignment 
    "LEFT"
                
    Case 1011
                    FontAlignment 
    "CENTER"
                
    Case Else
                    
    FontAlignment "RIGHT"
                
    End Select
            End Select
        End With
    End 
    Function
     
    Private Function 
    ClipBoard_SetData(MyString As String)
        
    Dim hGlobalMemory As LonglpGlobalMemory As Long
        Dim hClipMemory 
    As LongAs Long
        
        hGlobalMemory 
    GlobalAlloc(GHNDLen(MyString) + 1)
        
    lpGlobalMemory GlobalLock(hGlobalMemory)
        
    lpGlobalMemory lstrcpy(lpGlobalMemoryMyString)
        If 
    GlobalUnlock(hGlobalMemory) <> 0 Then
            MsgBox 
    "Could not unlock memory location. Copy aborted."
            
    GoTo OutOfHere2
        End 
    If
        If 
    OpenClipboard(0&) = 0 Then
            MsgBox 
    "Could not open the Clipboard. Copy aborted."
            
    Exit Function
        
    End If
        
    EmptyClipboard()
        
    hClipMemory SetClipboardData(CF_TEXThGlobalMemory)
    OutOfHere2:
        If 
    CloseClipboard() = 0 Then
            MsgBox 
    "Could not close Clipboard."
        
    End If
    End Function
     
    Private Function 
    DisplayedColor(Cell As RangeOptional CellInterior As Boolean True_
        Optional ReturnColorIndex 
    As Long True) As Long
        
        Dim X 
    As LongTest As BooleanCurrentCell As StringdColor   As Variant
        Dim F   
    As StringR  As Range
        
         
    '//Original code is written by Rick Rothstein
         '
    //http://www.excelfox.com/forum/f22/get-displayed-cell-color-whether-from-conditional-formatting-or-not-338/
        
        
    If Cell.Count 1 Then Err.Raise vbObjectError 999, , "Only single cell references allowed for 1st argument."
        
    CurrentCell ActiveCell.Address(00)
        For 
    1 To Cell.FormatConditions.Count
            With Cell
    .FormatConditions(X)
                If .
    Type xlCellValue Then
                    Select 
    Case .Operator
                    
    Case xlBetween:      Test Cell.Value >= Evaluate(.Formula1) And Cell.Value <= Evaluate(.Formula2)
                    Case 
    xlNotBetween:   Test Cell.Value <= Evaluate(.Formula1) Or Cell.Value >= Evaluate(.Formula2)
                    Case 
    xlEqual:        Test Evaluate(.Formula1) = Cell.Value
                    
    Case xlNotEqual:     Test Evaluate(.Formula1) <> Cell.Value
                    
    Case xlGreater:      Test Cell.Value Evaluate(.Formula1)
                    Case 
    xlLess:         Test Cell.Value Evaluate(.Formula1)
                    Case 
    xlGreaterEqualTest Cell.Value >= Evaluate(.Formula1)
                    Case 
    xlLessEqual:    Test Cell.Value <= Evaluate(.Formula1)
                    
    End Select
                
    ElseIf .Type xlExpression Then
                    Application
    .ScreenUpdating False
                     
    'Cell.Select
                    F = Replace(.Formula1, "$", vbNullString)
                    F = Replace(F, CurrentCell, Cell.Address(0, 0))
                     '
    Test Evaluate(.Formula1)
                    
    Test Evaluate(F)
                     
    'Range(CurrentCell).Select
                    Application.ScreenUpdating = True
                End If
                If Test Then
                    If CellInterior Then
                        dColor = IIf(ReturnColorIndex, .Interior.ColorIndex, .Interior.Color)
                        If IsNull(dColor) Then
                            dColor = IIf(ReturnColorIndex, Cell.Interior.ColorIndex, Cell.Interior.Color)
                        End If
                    Else
                        dColor = IIf(ReturnColorIndex, .Font.ColorIndex, .Font.Color)
                        If IsNull(dColor) Then
                            dColor = IIf(ReturnColorIndex, Cell.Font.ColorIndex, Cell.Font.Color)
                        End If
                    End If
                    DisplayedColor = dColor
                    Exit Function
                End If
            End With
        Next
        If CellInterior Then
            dColor = IIf(ReturnColorIndex, Cell.Interior.ColorIndex, Cell.Interior.Color)
        Else
            dColor = IIf(ReturnColorIndex, Cell.Font.ColorIndex, Cell.Font.Color)
        End If
        DisplayedColor = dColor
        
    End Function
    '
    Private Function ExcelVersion() As String
        Dim temp                  
    As String
     
        
    'On Error Resume Next
    #If Mac Then
        Select Case Val(Application.Version)
            Case 11: temp = "Excel 2004"
            Case 12: temp = "Excel 2008" ' 
    this should NEVER happen!
            Case 
    14temp "Excel 2011"
            
    Case 15temp "vNext"
            
    Case Else: temp "Unknown"
        
    End Select
    #Else
        
    Select Case Val(Application.Version)
            Case 
    9temp "Excel 2000"
            
    Case 10temp "Excel 2002"
            
    Case 11temp "Excel 2003"
            
    Case 12temp "Excel 2007"
            
    Case 14temp "Excel 2010"
            
    Case 15temp "Excel 2013"
            
    Case Else: temp "Unknown"
        
    End Select
    #End If
        
    ExcelVersion temp
    End 
    Function
    '
    '
    Private Function ColLtr(ByVal iCol As Long) As String
    ' shg 2012       http://www.excelfox.com/forum/f13/summary-of-maximum-rows-used-across-each-sheet-in-a-workbook-2053/#post9482
    Good for any positive Long
        
    If iCol 0 Then
        ColLtr 
    ColLtr((iCol 1) \ 26) & Chr(65 + (iCol 1Mod 26)
        Else
        
    End If
    End Function 
    Last edited by DocAElstein; 01-21-2016 at 09:05 PM.

Similar Threads

  1. Replies: 12
    Last Post: 09-22-2023, 03:53 PM
  2. Replies: 5
    Last Post: 06-10-2019, 10:14 PM
  3. HTML Code Test --post8798
    By DocAElstein in forum Test Area
    Replies: 19
    Last Post: 06-17-2018, 03:02 PM
  4. CODE TAG Code Test
    By DocAElstein in forum Test Area
    Replies: 5
    Last Post: 09-16-2015, 05:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •