locked
Open Excel Workbook with VBA code without Macro Warning RRS feed

  • Question

  • Hello,

    I have here a interesting but probably very complex question. My goal is code a program in other language (C# or VB 2010 are in the table) that does the following: 

    • Open EXCEL.EXE without Macro Warning
    • Pass a password to the workbook before open it. This means: all workbooks are protected with Open Passwords (more secure) so customer will not try to crack it to see VBA. So, for the customer he clicks on Something.exe that opens the Workbook and pass the password so he sees the workbook without the need to type the open password, but if he tries to open the .XLS directly he gots the password to open it. 

    Any ideas? Any hints are very helpful!


    Thank you,

    F. Schubert
    System Administrator

    MCP | Microsoft Certified Professional
    MCTS 70-640 | Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
    MCTS 70-642 | Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration

    Friday, February 24, 2012 12:59 PM

Answers

All replies

  • I can recomend you free add.

    This litlle application kill this message before you'll see ;]


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    Friday, February 24, 2012 7:49 PM
    Answerer
  • Hi Oskar,

    Thanks for the info, but the tool is not exactly what I want. It works with Outlook, I installed it but did not get any improvements. And also this is another tool that must be installed on client. 

    I will research more and if I find something I will post here.


    Thank you,

    F. Schubert
    System Administrator

    MCP | Microsoft Certified Professional
    MCTS 70-640 | Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
    MCTS 70-642 | Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration

    Saturday, February 25, 2012 1:38 PM
  • O gosh.. I was switch between Outlook n Excel forum ;P.

    Ok I do not have soft for kill worning macro in Excel, but I can give to you VBA script makes switch it off

    Dim oshell
    Set oshell = CreateObject("WScript.Shell")
        oshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Security\Level", 2, "REG_DWORD"
        oshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Security\AccessVBOM", 1, "REG_DWORD"
        oshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\LoadControlsInForms", 1, "REG_DWORD"
    Set oshell = Nothing

    Maybe that'll helps

    Numer et code

    14 = 2010

    12 = 2007

    11 = 2003

    Save this code as file*.vbs and run. Regards.


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved


    Saturday, February 25, 2012 6:16 PM
    Answerer
  • Thanks Oskar, 

    I have found something interesting here: http://www.codeproject.com/Articles/10257/Automating-MS-Excel-Using-Visual-Studio-NET, but to use the Class you will face some problems solved here: http://www.codeproject.com/Questions/64462/The-type-or-namespace-name-Office-does-not-exist-i and here: http://blogs.msdn.com/b/mshneer/archive/2009/12/07/interop-type-xxx-cannot-be-embedded-use-the-applicable-interface-instead.aspx.

    Using the class above and the Excel Object Library I could open a Excel application with Open Password, and also got NO security Warning.

    Now I still have one problem, the VBA code for Auto_Open is not being loaded... other VBA is OK, but the Auto_Open (which in my case calls a Form) is not loaded. Any help is appreciated :)


    Thank you,

    F. Schubert
    System Administrator

    MCP | Microsoft Certified Professional
    MCTS 70-640 | Microsoft Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
    MCTS 70-642 | Microsoft Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration

    • Marked as answer by CoffeineNerd Wednesday, March 20, 2013 2:14 AM
    Sunday, February 26, 2012 12:19 AM