Applies ToExcel 2016 til Mac

Senest opdateret: 10. april 2019

PROBLEM

En ny Visual Basic Editor blev introduceret i Excel til Mac i oktober 2017. Med denne nye Visual Basic Editor er der et problem med at oprette objekterklæringer ved brug af rullelistemenuen øverst i kodevinduet.

Hvis du klikker på rullelisten i venstre side og vælger et element på listen, modtager du nogle koder for den markerede begivenhed i rullelisten til højre. Du kan foretage flere valg fra rullelisten til højre for at oprette yderligere kode for at håndtere den valgte begivenhed.

I Visual Basic Editor vises rullelisten til objektvalg

I stedet opstår en fejl om at koden ikke er blevet oprettet.

Fejl i Microsoft Visual Basic: Brug af variabler og automatiseringstype understøttes ikke i Visual Basic.

STATUS: LØSNING

Vælg én af disse løsninger til dette problem:

LØSNING #1

Du kan udføre de samme trin på en computer med Excel til Windows og derefter kopiere koden til Excel til Mac.

LØSNING #2

Du kan gå til MSDN og finde syntaksen for den begivenhed, du vil bruge og skrive koden manuelt i VBA-projektet. Denne artikel beskriver Microsoft Excel "projektmappe"-begivenheder – Projektmappebegivenheder.

LØSNING #3

Kopiér den relevante hændelseskode fra eksemplerne nedenfor, og indsæt det i dit VBA-projekt. Sørg for at kopiere fra "Private Sub..." til og med "End Sub..." for hver begivenhed.

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

Flere ressourcer

Ikon-eksperter (hjerne, tandhjul)

Spørg eksperterne

Opret forbindelse til eksperter, diskuter de nyeste Excel-nyheder, opdateringer og bedste fremgangsmåder, og læs vores blog.

Excel Tech-community

Ikon-community

Få hjælp i communityet

Stil et spørgsmål, og find løsninger fra supportmedarbejdere, MVP'er, teknikere og andre Excel-brugere.

Forum for Excel-svar

Ikon-funktionsanmodningen (elpære, ide)

Foreslå en ny funktion

Vi vil meget gerne læse dine forslag og feedback! Del det, du tænker på. Vi lytter.

Giv feedback

Se også

Løsninger eller midlertidige løsninger på de seneste problemer i Excel til Mac

Har du brug for mere hjælp?

Vil du have flere indstillinger?

Udforsk abonnementsfordele, gennemse kurser, få mere at vide om, hvordan du sikrer din enhed og meget mere.

Communities hjælper dig med at stille og besvare spørgsmål, give feedback og høre fra eksperter med omfattende viden.

Find løsninger på almindelige problemer, eller få hjælp fra en supportmedarbejder.