-
1 Attachment(s)
clipboard activex for vba, vbs etc
i am posting an activex dll to simplify the clipboard usage for vba or any script language without clipboard object
hope it may be useful to someone
usage add a reference or createobject("clipbrd.clipboard")
has same methods as vb6 clipboard object
.settext text : returns boolean, true on success
.gettext : returns string
.clear : returns boolean
.setdata object, format : format is optional clipboard format, returns boolean
.getdata(format) : returns object
format parameter is optional and should be a clipboard constant value
Quote:
Constant Value Description
vbCFBitmap 2 Bitmap (.bmp files)
vbCFMetafile 3 Metafile (.wmf files)
vbCFDIB 8 Device-independent bitmap (DIB)
vbCFPalette 9 Color palette
Note the constants i copied from msdn may not all be correct, or are outdated, see
http://msdn.microsoft.com/en-us/library/ebwdx8yh.aspx
sample
vb Code:
Set myclip = CreateObject("clipbrd.clipboard")
SavePicture myclip.GetData(2), "C:\test\clippic.bmp"
to use unzip and register
vb6 source available if anyone wants
-
Re: clipboard activex for vba, vbs etc
Pete, I would love to see the source...
-
Re: clipboard activex for vba, vbs etc
Tested it with bmp. Works perfectly :) nice one pete :thumb:
and thanks for the source...
-
Re: clipboard activex for vba, vbs etc
Hello, could I have the source please? I've been looking for something like this for a while. Many thanks in advance.
-
Re: clipboard activex for vba, vbs etc
I have a question: I tried it in powerpoint but I can't copy shapes.
If I use the native .copy from powerpoint then I can use the getdata from the dll without any problem. However, the setdata on shapes doesn't put anything in the clipboard and the error message is "wrong format". So if I can't use it to copy shapes to the clipboard, what type of objects can I copy with setdata???
Thank you.
-
Re: clipboard activex for vba, vbs etc
Hi, this looks exactly like what i need, can you tell me how to register the dll and where to save it? many thanks in advance
David
Quote:
Originally Posted by
westconn1
i am posting an activex dll to simplify the clipboard usage for vba or any script language without clipboard object
hope it may be useful to someone
usage add a reference or createobject("clipbrd.clipboard")
has same methods as vb6 clipboard object
.settext text : returns boolean, true on success
.gettext : returns string
.clear : returns boolean
.setdata object, format : format is optional clipboard format, returns boolean
.getdata(format) : returns object
format parameter is optional and should be a clipboard constant value
Note the constants i copied from msdn may not all be correct, or are outdated, see
http://msdn.microsoft.com/en-us/library/ebwdx8yh.aspx
sample
vb Code:
Set myclip = CreateObject("clipbrd.clipboard")
SavePicture myclip.GetData(2), "C:\test\clippic.bmp"
to use
unzip and register
vb6 source available if anyone wants
-
Re: clipboard activex for vba, vbs etc
Quote:
can you tell me how to register the dll
regsvr32 fullpath\clipboard.dll
-
Re: clipboard activex for vba, vbs etc
Quote:
Originally Posted by
westconn1
regsvr32 fullpath\clipboard.dll
Hello, I am sorry to revive this dead thread, but I have used this DLL file on my application.. It works amazing on a 32-bit environment.. However some of my users are using a 64 bit version, in which I keep getting the error..
Quote:
Error 429 : ActiveX Component can't create object.
I tried the following,
VB Code:
Public Sub SaveClip2Bit(savePath As String)
On Error GoTo errHandler
Dim myClip As clipbrd.clipboard
'Dim myClip As Object
Set myClip = New clipbrd.clipboard
'Set myClip = CreateObject("clipbrd.clipboard")
AltPrintScreen
'Where AltPrintScreen is a Custom function to capture the active screen..
SavePicture myClip.getData(vbCFBitmap), savePath
exitOnErr:
Exit Sub
errHandler:
Resume exitOnErr
End Sub
but no avail.. So I just wanted to know is there a 64 bit equivalent of the same? If not can I please see the VBA code?
Just to add more info, I have Registered the DLL (using Admin mode) under the C:/Windows/SysWOW64.. I have tried it several times.. I just cannot overcome this error.. Am I doing something wrong? I hope not, as it works great on 32-bit. Would appreciate any help.
-
Re: clipboard activex for vba, vbs etc
i will look into it shortly
i have only recently got w7 x64, so could not try out before
-
Re: clipboard activex for vba, vbs etc
Thank you so much.. I really appreciate it.. Most of the code I found does not seem to work on the 64-bit environment.. A real pain with two different versions..
-
Re: need source code
Hi can you please provide the source code as my company policy will not allow me to use this library directly.Thanks
-
Re: clipboard activex for vba, vbs etc
Hello Pete, I forgot to post my solution.. After much trial, I finally managed to crack it.. However I did not use the 'Clipboard.DLL'.. I had to create my own code, by using various resources found online I was able to achieve this..
@mk8019 : If you would like to see the solution, please refer to the thread located at Access World Forums - Print Screen Into Image File, where I have placed a working demo to help you understand..
-
Re: clipboard activex for vba, vbs etc
sorry i did not get back to you, i intended to find the source code, but so far have not looked for it at all
glad you managed to find some solution
-
Re: clipboard activex for vba, vbs etc
That's okay Pete, but if you do find the code I would be happy to look at it.. Having a library function will look more neat.. Would appreciate if you could..
-
Re: clipboard activex for vba, vbs etc
having finally got around to testing, i found that this dll works fine on w7 64 bit, as long as it is registered correctly
must be done from an elevated command prompt, otherwise registration fails with error
-
Re: clipboard activex for vba, vbs etc
Is there any instruction on how to register using an elevated command prompt?
-
Re: clipboard activex for vba, vbs etc
run msdos prompt, by right click > run as administrator
-
Re: clipboard activex for vba, vbs etc
Hello!
How can i save image from clipboard in vbscript (there's no SavePicture)?
There I can save only binary data with ADODB.Stream/SAPI.SpFileStream.
-
Re: clipboard activex for vba, vbs etc
westconn1, сould you add a save function to your component?
Otherwise, work in the claimed vbs remains incompleted.
-
Re: clipboard activex for vba, vbs etc
sorry for the delay response, i did not see the new post, not that i was ignoring
saving pictures to disk was out side of the scope for this project
on searching i found an alternative using a freeware cmdline program, but i have not tested it
http://tips-testing.blogspot.com/200...-as-image.html
it links to the freeware at
https://www.irfanview.com/
it will allow to save directly to .jpg, so no need to convert from .bmp, which i was previously doing from vb6
i might be looking at this for my own use too
-
Re: clipboard activex for vba, vbs etc
sorry for the delay response, i did not see the new post, not that i was ignoring
saving pictures to disk was out side of the scope for this project
on searching i found an alternative using a freeware cmdline program, but i have not tested it
http://tips-testing.blogspot.com/200...-as-image.html
it links to the freeware at
https://www.irfanview.com/
it will allow to save directly to .jpg, so no need to convert from .bmp, which i was previously doing from vb6
i might be looking at this for my own use too
-
Re: clipboard activex for vba, vbs etc
westconn1
Thanks for the answer, but I wasn't interested in any image creation tools. I have been using IrfanView for more than 20 years and I know what it is capable of. The same goes for NirCmd. I want to be able to do this in the framework of the VBScript language and miniature ActiveX-components, which I connect with manifests without registration. And it is very sad that SavePicture is missing there. So I ask you to embed the function in the component so to be able to save an image from the clipboard in the context of GetData. If you will make an additional library where both possibilities will be present, I will be very grateful.
-
Re: clipboard activex for vba, vbs etc
I am attempting to use this dll with Excel. I have managed to register is with Windows and have referenced it within my vba project. But when I try to call it within the project I receive an error "Class Not Registered" when using the example code Set myClip = CreateObject("clipbrd.clipboard"). I am probably a bit over my head here but somehow I think I need to declare something in Class Module but not sure what.
Any help would be appreciated as this provides some functionality that I cannot find natively in Excel VBA at the moment when trying to save images from a worksheet.