VBA: Obtenez un presse-papiers HTML

J'ai utilisé VBA dans Excel pour naviguer vers une page Web dans Internet Explorer et copyr le contenu de la page Web dans le presse-papiers. Ensuite, j'ai utilisé la fonction GetHTMLClipboard () décrite ici https://support.microsoft.com/en-us/kb/274326 (et ci-dessous) pour accéder au HTML.

Récemment, cette fonction a cessé de fonctionner sur certaines pages Web dans Internet Explorer: la sData est comme "aP / Ò_3t.4aj3,1a¬2º -, () (db" et GetHTMLClipboard est nulle. Lorsque je teste la même page copiée depuis Chrome la fonction fonctionnera toujours. Je suis perdu et je serais reconnaissant pour toutes les suggestions.

Public Function GetHTMLClipboard() As Ssortingng Dim sData As Ssortingng If RegisterCF = 0 Then Exit Function If CBool(OpenClipboard(0)) Then Dim hMemHandle As Long, lpData As Long Dim nClipSize As Long GlobalUnlock hMemHandle 'Resortingeve the data from the clipboard hMemHandle = GetClipboardData(m_cfHTMLClipFormat) If CBool(hMemHandle) Then lpData = GlobalLock(hMemHandle) If lpData <> 0 Then nClipSize = lstrlen(lpData) sData = Ssortingng(nClipSize + 10, 0) Call CopyMemory(ByVal sData, ByVal lpData, nClipSize) Dim nStartFrag As Long, nEndFrag As Long Dim nIndx As Long 'If StartFragment appears in the data's description, 'then resortingeve the offset specified in the description 'for the start of the fragment. Likewise, if EndFragment 'appears in the description, then resortingeve the 'corresponding offset. nIndx = InStr(sData, "StartFragment:") If nIndx Then nStartFrag = CLng(Mid(sData, _ nIndx + Len("StartFragment:"), 10)) End If nIndx = InStr(sData, "EndFragment:") If nIndx Then nEndFrag = CLng(Mid(sData, nIndx + Len("EndFragment:"), 10)) End If 'Return the fragment given the starting and ending 'offsets If (nStartFrag > 0 And nEndFrag > 0) Then GetHTMLClipboard = Mid(sData, nStartFrag + 1, _ (nEndFrag - nStartFrag)) End If End If End If Call CloseClipboard End If End Function 

 Function RegisterCF() As Long 'Register the HTML clipboard format If (m_cfHTMLClipFormat = 0) Then m_cfHTMLClipFormat = RegisterClipboardFormat("HTML Format") End If RegisterCF = m_cfHTMLClipFormat End Function