Skip to content

Instantly share code, notes, and snippets.

View darkdreamingdan's full-sized avatar

Dan Chowdhury darkdreamingdan

View GitHub Profile
@darkdreamingdan
darkdreamingdan / Module1_p2.vb
Created May 10, 2016 18:41
Grab the path of an OLE temp file.
Function GetOLETempPath(obj As OLEObject) As String
Dim B() As Byte, Pos&, iEnd&, iStart&, iLength&
Dim Header As String
obj.Copy ' (49156 = Native format)
If Not GetData(49156, B) Then Exit Function
Dim Buffer$, FileName$, Extension$
Buffer = StrConv(B, vbUnicode)
Header = Chr$(0) & Chr$(0) & Chr$(3) & Chr$(0)
@darkdreamingdan
darkdreamingdan / Module1.vb
Created May 10, 2016 18:29
Grabbing Clipboard Data using VBA in Excel
Option Explicit
#If VBA7 Then
Private Declare PtrSafe Function _
CloseClipboard& Lib "user32" ()
Private Declare PtrSafe Function _
OpenClipboard& Lib "user32" (ByVal hWnd&)
Private Declare PtrSafe Function _
EmptyClipboard& Lib "user32" ()
Private Declare PtrSafe Function _
GetClipboardData& Lib "user32" (ByVal wFormat&)