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
Last edited by westconn1; Oct 13th, 2009 at 09:33 PM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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.
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
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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..
'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.
i will look into it shortly
i have only recently got w7 x64, so could not try out before
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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..
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..
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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..
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
run msdos prompt, by right click > run as administrator
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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.
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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.
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.