clipboard activex for vba, vbs etc-VBForums
Results 1 to 17 of 17

Thread: clipboard activex for vba, vbs etc

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,923

    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
    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:
    1. Set myclip = CreateObject("clipbrd.clipboard")
    2. SavePicture myclip.GetData(2), "C:\test\clippic.bmp"

    to use unzip and register

    vb6 source available if anyone wants
    Attached Files Attached Files
    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

  2. #2
    Super Moderator Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    11,928

    Re: clipboard activex for vba, vbs etc

    Pete, I would love to see the source...
    The poster formerly known as koolsid
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  3. #3
    Super Moderator Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    11,928

    Re: clipboard activex for vba, vbs etc

    Tested it with bmp. Works perfectly nice one pete

    and thanks for the source...
    The poster formerly known as koolsid
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  4. #4
    New Member
    Join Date
    Oct 2009
    Posts
    5

    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.

  5. #5
    New Member
    Join Date
    Oct 2009
    Posts
    5

    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.

  6. #6
    New Member
    Join Date
    Nov 2012
    Posts
    1

    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 View Post
    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:
    1. Set myclip = CreateObject("clipbrd.clipboard")
    2. SavePicture myclip.GetData(2), "C:\test\clippic.bmp"

    to use unzip and register

    vb6 source available if anyone wants

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,923

    Re: clipboard activex for vba, vbs etc

    can you tell me how to register the dll
    regsvr32 fullpath\clipboard.dll
    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

  8. #8
    New Member
    Join Date
    Apr 2013
    Posts
    5

    Re: clipboard activex for vba, vbs etc

    Quote Originally Posted by westconn1 View Post
    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..
    Error 429 : ActiveX Component can't create object.
    I tried the following,

    VB Code:
    1. Public Sub SaveClip2Bit(savePath As String)
    2. On Error GoTo errHandler
    3.     Dim myClip As clipbrd.clipboard
    4.     'Dim myClip As Object
    5.     Set myClip = New clipbrd.clipboard
    6.     'Set myClip = CreateObject("clipbrd.clipboard")
    7.     AltPrintScreen
    8.     'Where AltPrintScreen is a Custom function to capture the active screen..
    9.     SavePicture myClip.getData(vbCFBitmap), savePath
    10. exitOnErr:
    11.     Exit Sub
    12. errHandler:
    13.     Resume exitOnErr
    14. 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.

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,923

    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
    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

  10. #10
    New Member
    Join Date
    Apr 2013
    Posts
    5

    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..

  11. #11
    Registered User
    Join Date
    Apr 2013
    Posts
    1

    Thumbs up 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

  12. #12
    New Member
    Join Date
    Apr 2013
    Posts
    5

    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..

  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,923

    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
    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

  14. #14
    New Member
    Join Date
    Apr 2013
    Posts
    5

    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..

  15. #15

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,923

    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
    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

  16. #16
    New Member
    Join Date
    Apr 2013
    Posts
    5

    Re: clipboard activex for vba, vbs etc

    Is there any instruction on how to register using an elevated command prompt?

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,923

    Re: clipboard activex for vba, vbs etc

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.