Última atualização: 10 de abril de 2019
PROBLEMA
Apresentamos um novo Editor do Visual Basic no Excel para Mac em outubro de 2017. Nesse novo editor, há um problema relacionado à criação de declarações de objeto por meio das opções do menu suspenso na parte superior da janela de código.
Quando clica no menu suspenso à esquerda e escolhe um item da lista, você deve obter algum código para o evento selecionado na lista suspensa à direita. Você pode fazer seleções adicionais na lista suspensa à direita para criar outro código a fim de tratar o evento escolhido.
![Editor do Visual Basic mostrando a lista suspensa de seleção de objetos](https://support.content.office.net/pt-br/media/92d8bfb0-dd1b-45ee-b068-621bf3aa6c94.png)
Em vez disso, ocorre um erro informando que o código não foi criado.
![Erro do Microsoft Visual Basic: a variável usa um tipo de automação sem suporte no Visual Basic.](https://support.content.office.net/pt-br/media/a242ed6e-f56a-4abb-ad73-bcf2944a87c0.png)
STATUS: SOLUÇÃO ALTERNATIVA
Escolha uma das seguintes soluções alternativas para esse problema:
SOLUÇÃO ALTERNATIVA 1
Faça o mesmo procedimento em um computador com Excel para Windows e copie o código para o Excel para Mac.
SOLUÇÃO ALTERNATIVA 2
Vá para o MSDN, localize a sintaxe do evento que deseja usar e digite o código manualmente no projeto VBA. Este artigo descreve os eventos de "pasta de trabalho" do Microsoft Excel: Eventos de Pasta de Trabalho.
SOLUÇÃO ALTERNATIVA 3
Copie o código de evento apropriado dos exemplos abaixo e cole-o no projeto VBA. Copie de "Private Sub..." a "End Sub" para cada evento, inclusive.
Private Sub Workbook_Activate()
End Sub
Private Sub Workbook_AddinInstall()
End Sub
Private Sub Workbook_AddinUninstall()
End Sub
Private Sub Workbook_AfterRemoteChange()
End Sub
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
End Sub
Private Sub Workbook_BeforePrint(Cancel As Boolean)
End Sub
Private Sub Workbook_BeforeRemoteChange()
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
End Sub
Private Sub Workbook_Deactivate()
End Sub
Private Sub Workbook_NewChart(ByVal Ch As Chart)
End Sub
Private Sub Workbook_NewSheet(ByVal Sh As Object)
End Sub
Private Sub Workbook_Open()
End Sub
Private Sub Workbook_PivotTableCloseConnection(ByVal Target As PivotTable)
End Sub
Private Sub Workbook_PivotTableOpenConnection(ByVal Target As PivotTable)
End Sub
Private Sub Workbook_RowsetComplete(ByVal Description As String, ByVal Sheet As String, ByVal Success As Boolean)
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
End Sub
Private Sub Workbook_SheetBeforeDelete(ByVal Sh As Object)
End Sub
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
End Sub
Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
End Sub
Private Sub Workbook_SheetPivotTableAfterValueChange(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal TargetRange As Range)
End Sub
Private Sub Workbook_SheetPivotTableBeforeAllocateChanges(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
End Sub
Private Sub Workbook_SheetPivotTableBeforeCommitChanges(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
End Sub
Private Sub Workbook_SheetPivotTableBeforeDiscardChanges(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long)
End Sub
Private Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Object, ByVal Target As PivotTable)
End Sub
Private Sub Workbook_SheetPivotTableUpdate(ByVal Sh As Object, ByVal Target As PivotTable)
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
End Sub
Private Sub Workbook_SheetTableUpdate(ByVal Sh As Object, ByVal Target As TableObject)
End Sub
Private Sub Workbook_Sync(ByVal SyncEventType As Office.MsoSyncEventType)
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
End Sub
Private Sub Workbook_WindowResize(ByVal Wn As Window)
End Sub
Private Sub Worksheet_Activate()
End Sub
Private Sub Worksheet_BeforeDelete ()
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Worksheet_Calculate()
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
Private Sub Worksheet_Deactivate()
End Sub
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
End Sub
Private Sub Worksheet_LensGalleryRenderComplete()
End Sub
Private Sub Worksheet_PivotTableAfterValueChange(ByVal TargetPivotTable As PivotTable, ByVal TargetRange As Range)
End Sub
Private Sub Worksheet_PivotTableBeforeAllocateChanges(ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
End Sub
Private Sub Worksheet_PivotTableBeforeCommitChanges(ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
End Sub
Private Sub Worksheet_PivotTableBeforeDiscardChanges(ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long)
End Sub
Private Sub Worksheet_PivotTableChangeSync(ByVal Target As PivotTable)
End Sub
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Private Sub Worksheet_TableUpdate(ByVal Target As TableObject)
End Sub
Mais recursos
![Ícone de Especialistas (cérebro, engrenagens)](https://support.content.office.net/pt-br/media/ee188ecd-f93d-4573-9b01-e11973de3e9a.png)
Pergunte aos especialistas
Conecte-se com especialistas, participe de discussões sobre as mais recentes novidades, atualizações e práticas recomendadas do Excel e leia o nosso blog.
![Ícone da Comunidade](https://support.content.office.net/pt-br/media/f9cd8fac-e1df-4bd7-9f76-0098e0e77d7e.png)
Encontre ajuda na comunidade
Faça uma pergunta e encontre as soluções com os Agentes de Suporte, MVPs, Engenheiros e outros usuários do Excel.
![Ícone de Solicitação de recursos (lâmpada, ideia)](https://support.content.office.net/pt-br/media/4c746d07-a10c-46f3-afe5-17a8f9628ccc.png)
Sugira um novo recurso
É um prazer ler seus comentários e sugestões! Compartilhe suas ideias. Estamos ouvindo.
Confira também
Correções e soluções alternativas para problemas recentes no Excel para Mac