Preventing Problems With Worksheet Renaming
Preventing Problems With Worksheet Renaming
ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "SummarySheet"
Renames the object value of the worksheet. Comes in handy and streamlines the code.
I suspect VBA needs programmatic access to teh project model which can be solved here:
''RESOLUTION
''For any Automation client to be able to access the VBA object model programmatically, the user running the code must explicitly
''grant access. To turn on access, the user must follow these steps.
''
''Office 2003 and Office XP
''Open the Office 2003 or Office XP application in question. On the Tools menu, click Macro, and
''then click Security to open the Macro Security dialog box.
''
''On the Trusted Sources tab, click to select the Trust access to Visual Basic Project check box to turn on access.
''Click OK to apply the setting. You may need to restart the application for the code to run properly if you automate from a
''Component Object Model (COM) add-in or template.
''
''Office 2007
''Open the 2007 Microsoft Office system application in question. Click the Microsoft Office button, and then click Application Options.
''Click the Trust Center tab, and then click Trust Center Settings.
''Click the Macro Settings tab, click to select the Trust access to the VBA project object model check box, and then click OK.
''Click OK.
ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "SummarySheet"
Renames the object value of the worksheet. Comes in handy and streamlines the code.
I suspect VBA needs programmatic access to teh project model which can be solved here:
''RESOLUTION
''For any Automation client to be able to access the VBA object model programmatically, the user running the code must explicitly
''grant access. To turn on access, the user must follow these steps.
''
''Office 2003 and Office XP
''Open the Office 2003 or Office XP application in question. On the Tools menu, click Macro, and
''then click Security to open the Macro Security dialog box.
''
''On the Trusted Sources tab, click to select the Trust access to Visual Basic Project check box to turn on access.
''Click OK to apply the setting. You may need to restart the application for the code to run properly if you automate from a
''Component Object Model (COM) add-in or template.
''
''Office 2007
''Open the 2007 Microsoft Office system application in question. Click the Microsoft Office button, and then click Application Options.
''Click the Trust Center tab, and then click Trust Center Settings.
''Click the Macro Settings tab, click to select the Trust access to the VBA project object model check box, and then click OK.
''Click OK.
Comments
Post a Comment