Última Atualização: 10 de Abril de 2019
PROBLEMA
No Excel para Mac, foi introduzido um novo Visual Basic Editor em outubro de 2017. Neste novo Visual Basic Editor, existe um problema ao criar declarações de objetos através do menu pendente na parte superior da janela de código.
Se clicar no menu pendente à esquerda e selecionar um item na lista, deverá obter um código referente ao evento selecionado na lista pendente à direita. Pode fazer mais seleções na lista pendente à direita para criar código adicional para processar o evento selecionado.
Contudo, ocorre um erro e o código não é criado.
ESTADO: SOLUÇÃO
Selecione uma destas soluções temporárias para o problema:
SOLUÇÃO N.º 1
Pode efetuar um passo semelhante num computador a executar o Excel para Windows e, em seguida, copiar o código para o Excel para Mac.
SOLUÇÃO N.º 2
Pode aceder ao MSDN e localizar a sintaxe do evento que pretende utilizar e escrever o código manualmente no seu projeto do VBA. Este artigo descreve os eventos de livros do Microsoft Excel – Eventos de Livros.
SOLUÇÃO N.º 3
Copie o código do evento adequado a partir dos exemplos abaixo e cole-o no seu projeto do VBA. Para cada evento, certifique-se de que copia de "Private Sub..." a "End Sub", inclusive.
Private Sub Workbook_Activate()
End SubPrivate Sub Workbook_AddinInstall()
End SubPrivate Sub Workbook_AddinUninstall()
End SubPrivate Sub Workbook_AfterRemoteChange()
End SubPrivate Sub Workbook_AfterSave(ByVal Success As Boolean)
End SubPrivate Sub Workbook_BeforeClose(Cancel As Boolean)
End SubPrivate Sub Workbook_BeforePrint(Cancel As Boolean)
End SubPrivate Sub Workbook_BeforeRemoteChange()
End SubPrivate Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
End SubPrivate Sub Workbook_Deactivate()
End SubPrivate Sub Workbook_NewChart(ByVal Ch As Chart)
End SubPrivate Sub Workbook_NewSheet(ByVal Sh As Object)
End SubPrivate Sub Workbook_Open()
End SubPrivate Sub Workbook_PivotTableCloseConnection(ByVal Target As PivotTable)
End SubPrivate Sub Workbook_PivotTableOpenConnection(ByVal Target As PivotTable)
End SubPrivate Sub Workbook_RowsetComplete(ByVal Description As String, ByVal Sheet As String, ByVal Success As Boolean)
End SubPrivate Sub Workbook_SheetActivate(ByVal Sh As Object)
End SubPrivate Sub Workbook_SheetBeforeDelete(ByVal Sh As Object)
End SubPrivate Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
End SubPrivate Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
End SubPrivate Sub Workbook_SheetCalculate(ByVal Sh As Object)
End SubPrivate Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
End SubPrivate Sub Workbook_SheetDeactivate(ByVal Sh As Object)
End SubPrivate Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
End SubPrivate Sub Workbook_SheetPivotTableAfterValueChange(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal TargetRange As Range)
End SubPrivate Sub Workbook_SheetPivotTableBeforeAllocateChanges(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
End SubPrivate Sub Workbook_SheetPivotTableBeforeCommitChanges(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long, Cancel As Boolean)
End SubPrivate Sub Workbook_SheetPivotTableBeforeDiscardChanges(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal ValueChangeStart As Long, ByVal ValueChangeEnd As Long)
End SubPrivate Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Object, ByVal Target As PivotTable)
End SubPrivate Sub Workbook_SheetPivotTableUpdate(ByVal Sh As Object, ByVal Target As PivotTable)
End SubPrivate Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
End SubPrivate Sub Workbook_SheetTableUpdate(ByVal Sh As Object, ByVal Target As TableObject)
End SubPrivate Sub Workbook_Sync(ByVal SyncEventType As Office.MsoSyncEventType)
End SubPrivate Sub Workbook_WindowActivate(ByVal Wn As Window)
End SubPrivate Sub Workbook_WindowDeactivate(ByVal Wn As Window)
End SubPrivate Sub Workbook_WindowResize(ByVal Wn As Window)
End SubPrivate 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
Perguntar aos especialistas
Fale com especialistas, discuta as novidades mais recentes, atualizações e práticas recomendadas do Excel e leia o nosso blogue.
Obter ajuda na comunidade
Faça uma pergunta e encontre soluções com a ajuda dos Agentes de Suporte, MVPs, Engenheiros e outros utilizadores do Excel.
Sugerir uma nova funcionalidade
Adoramos ler as suas sugestões e o seu feedback! Partilhe as suas ideias. Estamos atentos ao seu feedback.
Consulte também
Correções ou soluções para problemas recentes no Excel para Mac