DoCmd.RunCommand acCmdPaste stopped working, think office 365 update

bignose2

Registered User.
Local time
Today, 03:11
Joined
May 2, 2010
Messages
232
Hi,

Sorry this is a little vague but just have no time, on holiday tomorrow & only have a few hours later.
I know this copy & paste is not pretty but worked for years. Works well with keeping rtf formatting

Get error, "paste is not available now."

This Windows 10 or Office have done a clipboard update.
Same all of a sudden on 2 PC's, fine on one at the moment?
When I tested in word, I got a message to say clipboard update to merge & other stuff, did not pay much attention, did not think important.
I have had this problem before when I tried using third party clipboards. History is OFF & I cleared it anyway.

Is there a way to revert to the most basic windows clipboard, as I type I think, there was a office clipboard sort off took over so will try to find but in the mean time, any ideas.
the function found around clipboad-seltext des not work well with rtf, it seems to copy & store as the simple html code <font> Hello etc etc.



Code:
            savepos = Me!eResponseLetter.SelStart
            
            Call Command250_Click  ' copy bookings  - does setfocus so check procedure if loses postion/focus at any time
    
            Me!eResponseLetter.SetFocus
            Me.eResponseLetter.SelStart = savepos
            Me.eResponseLetter.SelLength = 0
            
            ' Sleep (200)   ' ClipClip needs small delay, OEM seems OK - not using at moment so why slow down
            
'##############    sure if this or the COPY NOT WORKING, nothing with Ctrl V    ########################'
            DoCmd.RunCommand acCmdPaste   'Does NOT work with some third party cliboard managers - ClipClip looks good but errors


Code:
    Command250
        lots more code that this but see bottom ...
    
    
    Set r = CurrentDb.OpenRecordset(strSQL)
    

    If Not (r.EOF And r.BOF) Then     '  ==== There is actually a routine to call == GetBookings - used in EachEmail but leaving here a might want slighty differnt
        BookingsToPaste = BookingsToPaste & "Cat Bookings" & vbNewLine
        Me!DatesCopyPaste = Me!DatesCopyPaste & "Cat Bookings" & "<br/>"

        r.MoveFirst
        While (Not r.EOF)       ' need this while loop, did not seem ot be in DSL1 booking copy/paste, perhaps it was
            
            ' MsgBox DateValue(r!OutdateX)
            If DateValue(r!OutDateX) >= Date Then     ' only copy future dates, if want when in old can still copy from DSL1 bookings list
            
                If r!Code = "C" Then
                   IfCanc = "<b><font color=blue>  : Waiting List</font></b>"
                 Else
                    IfCanc = ""
                End If
                
                CatsEarliestDate = Format(DMin("CatsModDate", "[CatsModDate]", "[CatsID] =" & r!ID & ""), "dd-mmm-yy")  ' Min earliest date,
                
                '##                BookingsToPaste = BookingsToPaste & r!Names & "    " & r!dddIn & "  " & r!IndateX & "  To  " & r!dddOut & "  " & r!OutDateX & IfCanc & "     " & "{" & r!Qty & r!Code & "} First Booked : " & CatsEarliestDate & vbNewLine
                Me!DatesCopyPaste = Me!DatesCopyPaste & r!Names & "    " & r!dddIn & "  " & r!IndateX & "  To  " & r!dddOut & "  " & r!OutDateX & IfCanc & "     " & "{" & r!Qty & r!Code & "} First Booked : " & CatsEarliestDate & "<br/>"
                
' If r!Code = "C" Then
                If InStr(r!Comment, Chr(169)) > 0 Then
                    Me!DatesCopyPaste = Me!DatesCopyPaste & "<font color=blue>" & r!Comment & "</font>" & "<br/>"
                End If
' End If
                
            End If
            
            '        BookingsToPaste = BookingsToPaste & rst!Names & "   " & Format(rst!Indate, "ddd") & "  " & rst!Indate & "  To  " & Format(rst!Outdate, "ddd") & " " & rst!Outdate & vbNewLine
            ' tabs don't seem to get copied into clipboard
            r.MoveNext
        Wend
    
    End If
      
          
    '    MsgBox BookingsToPaste

    'BookingsToPaste = "This is a <FONT size=5><FONT color=#800000><strong>TEST message</strong><FONT size=3>.<FONT color=#000000>" & _
    '        " to check <I>HTML email</I> with no attachments from the <B><I>CDOEMailTester</B></I> application" & _
    '       " <P><B><U>Example Image:</B></U></P>"
    '
  
    
    '    ClipBoard_SetText (BookingsToPaste) - does NOT retain rtf format, need a control on the form, does now need extra set focus & seltext but OK
    
    Me!DatesCopyPaste.SetFocus
    DoCmd.RunCommand acCmdCopy    '##############    sure if this or the paste NOT WORKING, nothing with Ctrl V    ########################'
 
    
    ' thought baout replace but wonder if the email is very long is such a godd idea
  
    ' ClipBoard_SetText ("<font size=2><strong>Orginally Received 06-04-2022 08:54:27 : Brought forward to 18-05-2022 12:03:23</strong></font>")
    '<div><font size=2><strong>Orginally Received 06-04-2022 08:54:27 : Brought forward to 18-05-2022 12:03:23</strong></font>
    'Clipboard.SetText RichTextBox1.TextRTF, vbCFRTF
          
    r.Close
 
Does manual copy and paste work? If so, you might try using the clipboard API calls until the bug fix comes out.

PS. I actually don't have any idea if it's a bug or not.
 
V.Odd, manual copy/paste does NOT work.
I have this textbox where I store all that data collected from the query
briefly made big so I can select, copy & paste but does not work..

Now getting a NEW little window that says "item 2 of 24 items collected"
then "format not supported by office clipboard" when I try to paste but actually think that is from the copying

I think a little like the 3rd party clipboards got a bit smarter & simple cmdpaste does not work, although as your question implies, manual should really work, best guess is the rft html may not be liked by the clipboard
 
Away for a few days so will test later,

Does seem to be OK at the moment, really odd, I always do a few restarts first thing but did not help, done a few more and opening & closing word, excel, lots of copy & pastes of different sorts & working as normal in access.
 

Users who are viewing this thread

Back
Top Bottom