Posts by Ivan F Moala

    Re: Count Mouse Clicks On Cell


    Don't know the overall requirements of the request BUT you CAN DO this
    via some API's and, as you have suggested swapping the mouse + Event code


    Note: It needs the AddressOf operator so will only work in Xl2000+


    This example Monitors a range = C2:C20 ..... No real testing done.


    You need to Start the timer to monitor the Range ....


    This is just ONE way to do it ... NO Real testing....

    Re: Releasing Object Variables


    As a Rule; Anything that your program has to acquire via CreateObject, Set, Get etc you should release.
    Even if the documentation states that Windows takes care of releasing the resource used by a process when it exits.


    The cost to you is just a few lines of code, BUT, NOT having resorces released properly can
    be detrimental to the running performance.


    On the lower level API programing this is very true.
    In APIs that Create, open, extract etc it is IMPORTANT that you use it's corresponding "Release" API to release resources to it. eg using the API CopyEnhMetaFileA, Windows keeps a record of GDI objects on a per-process basis, only the application that created the GDI object is able to use the corresponding GDI functions with it or remove it from the system eg delete it.
    The API we need to ALWAYS USE for this is DeleteEnhMetaFile.


    So if you used;
    LoadBitmapA > then you need to use DeleteObject to release resources
    CreateBitmap > DeleteObject
    CreateSolidBrush > DeleteObject
    CreateCursor > DestroyCursor
    CreateCompatibleDC > DeleteDC
    GetDC > ReleaseDC
    CreateFontA > DeleteObject
    CreateIcon > DestroyIcon
    ExtractIconA > DestroyIcon
    CreateMetaFileA > CloseMetaFile
    CopyMetaFileA > DeleteMetaFile


    So to be on the safe side I always Set to nothing

    Re: Worksheet Change Event Intersect Error 91



    Your original code was not a Worksheet change event, hence my response that Target
    was NOT defined ...


    You had


    Code
    Sub T()
    etc .............

    Re: Disable Alt+f11 Shortcut Key


    Quote from royUK

    Agreed, the VBA password can be broken, but not easily. Messing about with Menubars, settings etc can cause problems if you don't restore everything correctly. If you want to lock a project completely see here


    Hi Roy, that Method is a good way to stop access.
    And yes it will stop most hackers.

    Re: Stop Users Changing Computers Time/Date



    Yep, that would work .... so the solution would involve IT, which most IT depts would set up for their LAN and WAN by default, at least from what I have seen, unless like in my case our productin PC is not set (in fact it is the only one ?) in which case I have set up the proposed routine I mentioned earlier, to check the server time. All other PC's cannot change there system time as they Don't have access to it.

    Re: Stop Users Changing Computers Time/Date



    Yes, so how do you propose to impliment this programatically for users and then return control back to them after workbook is closed ?
    Via VBS, WMI, or other scripting languages.

    Re: Adding Items to Combo From Another File


    You need to think how you would get duplicates manually using native Excel.
    So one method to do this is to use Advanced filter.


    Basically (Provided file is open)
    Advance fileter on Data (unique), Place data in std location.
    Loop through this location adding to combobox.


    Thats the steps to take for one way to do this.


    Post back if you have problems in doing the code and I'm sure someone can help you through it.

    Re: Replacing sets of names- there must be any easy way


    Greg, something like this doesn't require singular scripts and is easy to do with a macro provided we know what data, ranges etc. In fact you could do it with out code if I understand you correctly.


    Is is possible to upload a rough work book ?