Consulting

Results 1 to 10 of 10

Thread: Solved: Run Once Then Delete Code

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Posts
    15
    Location

    Solved: Run Once Then Delete Code

    Hi experts,

    I tried running the workbook at http://vbaexpress.com/kb/getarticle.php?kb_id=511 and it didn't do what it was supposed to, i.e. to delete the module.

    Is the code absolutely correct, or am I doing something horribly wrong, or what?

    Cheers,
    Steve

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Working fine for me.

  3. #3
    VBAX Regular
    Joined
    Nov 2007
    Posts
    15
    Location
    Dear Charlize,

    I followed the "test the code" instructions exactly. Absolutely no success, even after several atempts, just to make sure I was doing everything correctly.

    Another issue: in the "How to use" instruction, I don't understand steps 4 and 5,

    quote

    4. Select the thisWorkbook module
    5. Copy and paste the ThisWorkbook module code into this Module

    unquote

    What is the "ThisWorkbook module", and where do I find it.

    Although I am a Newbie at VBA, I pick things up very easily, and have already created several projects;

    but I am totally confused with this one. Any other suggestions?

    Cheers,
    Steve

  4. #4
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    In the Project Explorer window (usually top left window) in the VBEditor, for each project you will see a folder called Microsoft Excel Objects. Within this you will see each sheet and a ThisWorkbook object. Double-click the ThisWorkbook object to see its module.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Click here for a short flash presentation that will show you how to find the thisworkbook module.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    VBAX Regular
    Joined
    Nov 2007
    Posts
    15
    Location
    Thanks Rory and Steve,

    I had no problem identifying the various elements of the editor window.

    As I said, I followed the "Test the code" instructions to the letter. I even set Macro Security to Low. I looked at the references, and Microsoft Visual Basic for Applications Extensibility 5.3 is checked. No problem there.

    At Step 8, the "RunOnceModule" was still there, and regardles of how many times I opened and saved and closed the workbook, no change.

    To clarify, I'm running Microsoft Excel 2002 SP3 on XP Professional.

    Any suggestions?

    Cheers,
    Steve

  7. #7
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    I downloaded the workbook and it does not work (delete the module) for me either (xl2K, WinXP)
    "It's not just the due date that's important, it's also the do date" [MWE]

    When your problem has been resolved, mark the thread SOLVED by clicking on the Thread Tools dropdown menu at the top of the thread.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Did you remove the apostrophe at the start of the code line as advised in the comment?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    VBAX Mentor tpoynton's Avatar
    Joined
    Feb 2005
    Location
    Clinton, MA
    Posts
    399
    Location
    test workbook worked for me (Excel 2003, WinXP). it didnt the first time, because I didnt read the instructions

  10. #10
    VBAX Regular
    Joined
    Nov 2007
    Posts
    15
    Location
    Hi VBAExpress users, problem solved - security issue.

    To be able to run the code as intended, you must go to Tools>Macro>Security - Trusted Sources and check Trust access to Visual Basic Project before running the code/workbook. Once this is done, it works perfectly.

    Cheers,

    Steve T

Posting Permissions

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