Problem mit Copy & Paste im Flexgrid 8 (Unicode / ActiveX)

Posted by: t.schroeer on 3 November 2019, 8:51 pm EST

    • Post Options:
    • Link

    Posted 3 November 2019, 8:51 pm EST

    Hello everyone

    I have an MSAccess 2013 frontend en delivery note processing form. In this form I have installed the ActiveX Flexgrid version 8.0 (Unicode) (ComponentOne 20191.1.1). The value should be entered in the remark column and also by copy & paste. The manual input works great, only the input via the clipboard does not work. Do I have to reconfigure something for it?

    So I configured the Flexgrid:

    Private Sub c1fgSetDataSource(ByVal sSQL As String)
        On Error GoTo c1fgSetDataSource_Error_DefaultHandler ' --- Standard-Fehlerbehandlung
        
        c1fg.Rows = 1
        c1fg.Clear 'flexClearEverywhere
        
        SetDataSource "C1FG", sSQL
    
        m_bolNoSel = False
    
        c1fg.Redraw = flexRDNone
        c1fg.Appearance = flexFlat
        c1fg.DataMode = flexDMFree ' flexDMBound
        c1fg.VirtualData = True
        c1fg.Editable = flexEDKbdMouse
        c1fg.Flags = flexCFAutoClipboard
        c1fg.FixedCols = 0
        c1fg.FixedRows = 1
        c1fg.SelectionMode = flexSelectionListBox
        c1fg.AllowSelection = True
        c1fg.ExplorerBar = flexExNone
        c1fg.AutoResize = True
        c1fg.AutoSizeMode = flexAutoSizeColWidth
        c1fg.AllowUserResizing = flexResizeColumns
        c1fg.BackColorBkg = RGB(&H31, &H30, &H31)
        c1fg.SheetBorder = RGB(&H31, &H30, &H31)
        c1fg.BackColor = vbWhite
        c1fg.BackColorAlternate = RGB(&HDD, &HDD, &HDD)
        c1fg.BackColorFixed = RGB(&H55, &H55, &H55)
        c1fg.ForeColorFixed = vbWhite
        c1fg.BackColorSel = RGB(&HBB, &HBB, &HBB)
        c1fg.FontSize = Me.cboC1fgFontSize
        c1fg.Gridline = flexGridNone
        c1fg.GridLinesFixed = flexGridNone
        c1fg.GridLineWidth = 0
        c1fg.Cell(flexcpFontBold, 0, 0, 0, c1fg.Cols - 1) = True
        c1fg.RowHeight(0) = 500
        c1fg.ShowComboButton = flexSBAlways
        c1fg.AutoSizeMode = flexAutoSizeColWidth
        c1fg.FixedAlignment(COL_PLAN_LS_DATUM) = flexAlignLeftCenter
        c1fg.FixedAlignment(COL_PLAN_RÜCK_DATUM) = flexAlignLeftCenter
        c1fg.FixedAlignment(COL_PREIS_DM) = flexAlignLeftCenter
        c1fg.FocusRect = flexFocusRaised 'flexFocusInset 'flexFocusHeavy
        
        m_bolFGCellChanged = False
        Set c1fg.DataSource = m_rs
        DoEvents
        m_bolFGCellChanged = True
    
        If (c1fg.Rows > 1) And (c1fg.Row > 0) Then
            CachingCurrentData
        Else
            Me.txtRowart = vbNullString
            Me.txtArtikelname = vbNullString
            Me.txtLS_Ort = vbNullString
            Me.txtPlan_LS_Datum = vbNullString
            Me.txtPlan_Rück_Datum = vbNullString
            Me.txtSNR = vbNullString
            Me.txtArtikeltyp = vbNullString
            Me.txtAnzahl = vbNullString
            Me.txtAnzMiettage = vbNullString
            Me.txtRück_Ort = vbNullString
            Me.txtLieferadresse = vbNullString
            Me.txtPauschal_Art = vbNullString
        End If
    
        c1fgSetLayout
        c1fg.Redraw = True
        
        m_bolNoSel = True
        
    GoTo c1fgSetDataSource__Exit '-------------------------------------------------
    c1fgSetDataSource_Error_DefaultHandler:
        Select Case Error_DefaultHandler("Auftrag_LS.ACF", "c1fgSetDataSource")
            Case vbAbort
                Resume c1fgSetDataSource__Exit
            Case vbRetry
                Resume
            Case vbIgnore
                Resume Next
        End Select
    c1fgSetDataSource__Exit:     '-----------------------------------------------------
    End Sub
    
    
  • Posted 3 November 2019, 9:20 pm EST

    Hi,

    VBA doesn’t actually support the Clipboard object. You can still access the clipboard as below:

    
    'This is how to clear the clipboard in VBA:
    
    Dim MyData As DataObject
    
    Set MyData = New DataObject
    MyData.SetText ""
    MyData.PutInClipboard
    
    ' This is how to get the text on the clipboard into a string variable:
    
    Dim MyData As DataObject
    Dim strClip As String
    
    Set MyData = New DataObject
    MyData.GetFromClipboard
    strClip = MyData.GetText
    
    'This is how to get the text from a string variable into the clipboard:
    
    Dim MyData As DataObject
    Dim strClip As String
    strClip = "Hi there"
    
    Set MyData = New DataObject
    
    MyData.SetText strClip 
    MyData.PutInClipboard
    
    

    The DataObject is a part of the Forms library in VBA. In order to make this code work, you must do one of the two things:

    1. Have at least one UserForm in your project, or
    2. In the VBA editor, go to Tools, References, and set a reference to the “Microsoft Forms 2.0 Object Library”

    Note: There are Cut, Copy, Paste and Clear methods available for the control which can be used to implement the clipboard support manually.

    Also, please be noted that we do not support VBA as our controls are neither tested nor supported in this environment.

    ~Pragati

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels