Results 1 to 7 of 7
  1. #1
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Disable Macros (97 SR2)

    Hi Drk,
    What exactly do you mean by 'open a series of macros'? Do you mean you want to view the code?
    Regards,
    Rory

    Microsoft MVP - Excel

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable Macros (97 SR2)

    No.. let me clarify.

    Admindb.xls is a parser. Essentially, it pulls filled in ranges of data from a series of spreadsheets. Each of these spreadsheets is exactly the same, and each contain code that executes when the sheet is opened. This code captures the username from the network and assigns this value to a specified range in the workbook:

    Sub Workbook_Open()
    if range("B1").locked = true then exit sub
    Range("A1").value = fosusername
    Range("B1").value = range("a1").value
    Range("B1").locked = true
    end sub

    If the workbook is subsequently opened, this opening code will by bypassed. The problem however, is that this isn't bypassed until the user opens 'thier' workbook.

    What i'm looking for is a way to halt all workbook code within a workbook if i'm opening the workbook from another one. Admin DB cycles through a given directory and opens all files within that directory, pulling out only fields which have been populated with sets of data. it then saves itself as 'compiledmmdd.xls' to allow for simple review of all data up to that point.

    Simply, I want the system to click 'Disable Macros' when opening another book.

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable Macros (97 SR2)

    <P ID="edit" class=small>Edited by DrkRealm on 13-Nov-01 10:22.</P>I know it sounds a bit bizzare, but I'm looking for a way to open a series of worksheets without running thier code.

    I can't seem to determine if the Workbook.Open event allows code to run on the 'Child' sheet.

    Any ideas?

    edited.. macros was a typo... <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Disable Macros (97 SR2)

    Oh OK.
    I think you want Application.EnableEvents = False then. Just remember to turn it back on at the end!
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable Macros (97 SR2)

    will that disrupt the main workbook?
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Disable Macros (97 SR2)

    It will prevent all events from occurring until it's turned back on. I wouldn't have thought you have any actual event code that needs to run while consolidating your data but if you do, you should be able to disable events, open the new worbook, then reenable events without the workbook_open code being triggered.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disable Macros (97 SR2)

    Not if you set it back to True before doing anything that would trigger an event on the "main" worksheet.
    Legare Coleman

Posting Permissions

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