|
| 1 | +--- |
| 2 | +title: Enable access to VBA to create or open a Visual Studio Tools for the Microsoft Office System project |
| 3 | +decsprition: "You must explicitly enable access to the Office VBA project system before you can create or open a Visual Studio Tools for Office System project" |
| 4 | +ms.custom: "" |
| 5 | +ms.date: "02/02/2017" |
| 6 | +ms.technology: office-development |
| 7 | +ms.prod: visual-studio-dev15 |
| 8 | +ms.topic: "conceptual" |
| 9 | +f1_keywords: |
| 10 | + - "vst.project.vbawrongversion" |
| 11 | + - "VST.Project.VBASecurityGenericError" |
| 12 | + - "VST.Project.VBASecurityPermissions" |
| 13 | + - "VST.SelectDocWizard.MissingCOM" |
| 14 | + - "VST.Project.VBASecurityNotSet" |
| 15 | +dev_langs: |
| 16 | + - "VB" |
| 17 | + - "CSharp" |
| 18 | +author: TerryGLee |
| 19 | +ms.author: tglee |
| 20 | +manager: douge |
| 21 | +ms.workload: |
| 22 | + - "office" |
| 23 | +--- |
| 24 | +# Enable access to VBA to create or open a Visual Studio Tools for the Microsoft Office System project |
| 25 | + |
| 26 | +You must explicitly enable access to the Visual Basic for Applications (VBA) project system in Microsoft Office before you can create or open a Visual Studio Tools for the Microsoft Office System project. |
| 27 | + |
| 28 | + Microsoft Office development projects require access to the Visual Basic for Applications (VBA) project system in Microsoft Office Word and Microsoft Office Excel, even though the projects do not use Visual Basic for Applications. Design-time support of controls in both Visual Basic and C# projects depends on the Visual Basic for Applications project system. |
| 29 | + |
| 30 | + Some Microsoft Office macro viruses attempt to automate the Visual Basic for Applications project system as a means to propagate themselves. By enabling access to the Visual Basic for Applications project system, you remove a safeguard that helps prevent the spread of macro viruses. However, normal macro security remains in place, so the macro security level and the list of trusted publishers that you maintain for your Office applications will determine whether any macro runs on your computer. |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> This applies only to the development computer. End-user computers do not need this option enabled to run Office solutions. |
| 34 | +
|
| 35 | + It is important to note that disabling access to the Visual Basic for Applications project system on its own does not protect you from viruses, it simply helps to stop some viruses from spreading to other documents if your computer ever becomes infected with a macro virus. The option is disabled by default as an added layer of protection for your computer, but enabling it does not make your computer any more susceptible to viruses if you are following security best practices. |
| 36 | + |
| 37 | + The best protection against Office macro viruses is to run Office at the High or Very High security level, to only trust macros from verified, known sources, and to stay up-to-date with security patches and virus scanners. |
| 38 | + |
| 39 | + For more information about protecting your PC from viruses and other malicious code, see [http://www.microsoft.com/protect](http://www.microsoft.com/protect). |
| 40 | + |
| 41 | + You can enable or disable the option **Trust Access to Visual Basic Project** manually. |
| 42 | + |
| 43 | + You can repair your installation of Office if you see VBA or COM errors. |
| 44 | + |
| 45 | +## To enable or disable access to Visual Basic Projects |
| 46 | + |
| 47 | +1. Click the **File** tab. |
| 48 | + |
| 49 | +2. Click **Options**. |
| 50 | + |
| 51 | +3. Click **Trust Center**, and then click **Trust Center Settings**. |
| 52 | + |
| 53 | +4. In the **Trust Center**, click **Macro Settings**. |
| 54 | + |
| 55 | +5. Check or uncheck **Trust access to the VBA project object model** to enable or disable access to Visual Basic Projects. |
| 56 | + |
| 57 | +6. Click **OK**. |
| 58 | + |
| 59 | +### To enable or disable access to Visual Basic Projects with the 2007 Microsoft Office system |
| 60 | + |
| 61 | +1. On the **Tools** menu in Word or Excel, point to **Macro**, and then click **Security**. |
| 62 | + |
| 63 | +2. In the **Security** dialog box, click the **Trusted Publishers** tab. |
| 64 | + |
| 65 | +3. Select to enable, or clear to disable, **Trust Access to Visual Basic Project**. |
| 66 | + |
| 67 | +4. Click **OK**. |
| 68 | + |
| 69 | +## To set your Office macro security level |
| 70 | + |
| 71 | +1. Click the **File** tab. |
| 72 | + |
| 73 | +2. Click **Options**. |
| 74 | + |
| 75 | +3. Click **Trust Center**, and then click **Trust Center Settings**. |
| 76 | + |
| 77 | +4. In the **Trust Center**, click **Macro Settings**. |
| 78 | + |
| 79 | +5. In the **Macro Settings** section, select the desired setting. |
| 80 | + |
| 81 | +6. Click **OK**. |
| 82 | + |
| 83 | +### To set your Office macro security level with the 2007 Microsoft Office system |
| 84 | + |
| 85 | +1. On the **Tools** menu in Word or Excel, point to **Macro**, and then click **Security**. |
| 86 | + |
| 87 | +2. On the **Security Level** tab, select the desired setting. |
| 88 | + |
| 89 | + The **Security Level** tab contains details about each level. For more information, see the topic "Macro Security Levels" in Office Help. |
| 90 | + |
| 91 | +### To install VBA with the 2007 Microsoft Office system |
| 92 | + |
| 93 | +1. In Control Panel, run **Add or Remove Programs** or **Programs and Features**. |
| 94 | + |
| 95 | +2. Select Office in the **Currently installed programs** list. |
| 96 | + |
| 97 | +3. Click **Change**. |
| 98 | + |
| 99 | +4. Select **Add or Remove Features**, and then click **Continue**. |
| 100 | + |
| 101 | +5. Select **Choose advanced customization of applications**, and then click **Next**. |
| 102 | + |
| 103 | +6. Expand **Office Shared Features** in the **Choose update options for applications and tools** list. |
| 104 | + |
| 105 | +7. Open the drop-down menu next to **Visual Basic for Applications**, and then click **Run from My Computer**. |
| 106 | + |
| 107 | +8. Click **Continue**. |
| 108 | + |
| 109 | +9. Click **Close**. |
| 110 | + |
| 111 | +## To repair your installation of Office |
| 112 | + |
| 113 | +1. In Control Panel, run **Add or Remove Programs** or **Programs and Features**. |
| 114 | + |
| 115 | +2. Select your version of Office in the **Currently installed programs** list. |
| 116 | + |
| 117 | +3. Click **Change**. |
| 118 | + |
| 119 | +4. Select **Reinstall or Repair**, and then click **Next**. |
| 120 | + |
| 121 | +5. Select **Detect and Repair errors in my Office installation**, and then click **Install**. |
| 122 | + |
| 123 | +## See also |
| 124 | + |
| 125 | + [Securing Office Solutions](../vsto/securing-office-solutions.md) |
0 commit comments