Results 1 to 5 of 5

Thread: Opening an Excel sheet which contains macros

  1. #1

    Thread Starter
    Banned
    Join Date
    May 2003
    Posts
    37

    Opening an Excel sheet which contains macros

    Visual basic 6.0
    During opening an excel sheet which contains macros a pop-up window ask you to select to enable or disable macros.
    In a visual basic program which opens such file to read or write data, how can I make the program to select automatically from the pop up window to enable or disable macros or to close the pop up window in order to complete data reading or wtiting?
    Last edited by jamesg; Jun 11th, 2005 at 03:26 PM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Opening an Excel sheet which contains macros

    from within excel, you can stop the dialog from displaying, by either lowering the security level so that macros are always permitted, or you can digitally sign your macros and add that signature to the trusted signatures.

    if you don't have permissions to do that, probably you should not try to disable the warning

    pete

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Opening an Excel sheet which contains macros

    You never want to lower your security settings to low. You could set Displayalerts off but then you will get the default button choice,
    which in this case is, Disabled.

    Like westconnt mentioned you could digitally sign your code but it would only be for personal use. If you need to distribut your app then a profesional
    public certificate is needed. You dont want anyone to take your private DS and use it without your approval.

    Check out my CodeBank tutorial on Creating a Trusted Digital Signature.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Opening an Excel sheet which contains macros

    i can close the macro warning box easy enough, using sendkeys, but it leads to other problems, that are undesirable.

    you would need to use apis to make it work reliably

    pete

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Opening an Excel sheet which contains macros

    I doubt that the macros dialog box window is manipulatable via APIs like SendMessage and PostMessage as this would completely
    defeat the medium level of macro security. It would allow code to automatically enable a macro and run it without the users approval.

    SendKeys is probably the only option although not a good one.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width