ник: MS_4G
Это скрипт, о котором я сообщал; он делает, что мне нужно
Option Compare Database
Public Const GHND = &H42
Public Const CF_TEXT = 1
' Функции для работы с буфером обмена Office.
Public Declare Function GlobalUnlock Lib "Kernel32" (ByVal hMem As Long) As Long
Public Declare Function GlobalLock Lib "Kernel32" (ByVal hMem As Long) As Long
Public Declare Function GlobalAlloc Lib "Kernel32" (ByVal wFlags As Long, _
ByVal dwBytes As Long) As Long
Public Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long
Public Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, _
ByVal hMem As Long) As Long
Public Declare Function lstrcpy Lib "Kernel32" (ByVal lpString1 As Any, _
ByVal lpString2 As Any) As Long
Public Function fnCLPSetData(sS As String) As String
Dim hGlobalMemory As Long, lpGlobalMemory As Long
Dim hClipMemory As Long, X As Long
' Allocate moveable global memory.
' -------------------------------------------
hGlobalMemory = GlobalAlloc(GHND, Len(sS) + 1)
' Lock the block to get a far pointer to this memory.
lpGlobalMemory = GlobalLock(hGlobalMemory)
' Copy the string to this global memory.
lpGlobalMemory = lstrcpy(lpGlobalMemory, sS)
' Unlock the memory.
If GlobalUnlock(hGlobalMemory) <> 0 Then
' Call fnMsgBoxErrOK("fnCLPSetData" + vbCrLf + _
"Could Not unlock memory location. Copy aborted.", "Ошибка")
fnCLPSetData = ""
GoTo l_End
End If 'GlobalUnlock(hGlobalMemory) <> 0
' Open the Clipboard to copy data to.
If OpenClipboard(0&) = 0 Then
' Call fnMsgBoxErrOK("fnCLPSetData" + vbCrLf + _
"Could Not Open the Clipboard. Copy aborted.", "Ошибка")
fnCLPSetData = ""
Exit Function
End If 'OpenClipboard(0&) = 0
' Clear the Clipboard.
X = EmptyClipboard()
' Copy the data to the Clipboard.
hClipMemory = SetClipboardData(CF_TEXT, hGlobalMemory)
l_End:
If CloseClipboard() = 0 Then
' Call fnMsgBoxErrOK("fnCLPSetData" + vbCrLf + _
"Could Not close Clipboard.", "Ошибка")
End If 'CloseClipboard() = 0
fnCLPSetData = sS
End Function
. . .
' Это обращение к занесению данных в буфер
fnCLPSetData (strDS)
. . .
' Это вставка из буфера его содержимого в нужное место
DoCmd.RunCommand acCmdPaste