marleen009
Gebruiker
- Lid geworden
- 19 sep 2011
- Berichten
- 25
Hallo,
Ik heb zopas een Mac met office pakket, maar ben Windows gewoon.
Heb nu een macro die in Windows Word perfect werkt, overgebracht in Word voor Mac.
Als ik deze macro wil uitvoeren krijg ik de melding:
Kan de programmacode niet uitvoeren in de onderbrekingsmodus.
de macro:
Moet ik hier misschien iets aan aanpassen??
Alvast bedankt voor een antwoord :thumb:
Ik heb zopas een Mac met office pakket, maar ben Windows gewoon.
Heb nu een macro die in Windows Word perfect werkt, overgebracht in Word voor Mac.
Als ik deze macro wil uitvoeren krijg ik de melding:
Kan de programmacode niet uitvoeren in de onderbrekingsmodus.
de macro:
Code:
Sub InsertMultipleImages()
Dim fd As FileDialog
Dim oTable As Table
Dim sNoDoc As String
Dim itm As Variant, tmp As Variant
If Documents.Count = 0 Then
sNoDoc = MsgBox(" " & "No document open!" & vbCr & vbCr _
& "Do you wish to create a new document to hold the images?", _
vbYesNo, "Insert Images")
If sNoDoc = vbYes Then
Documents.Add
Else
Exit Sub
End If
End If
'add a 1 row 2 column table to take the images
Set oTable = Selection.Tables.Add(Selection.Range, 1, 3)
oTable.AutoFitBehavior (wdAutoFitFixed)
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Title = "Select image files and click OK"
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png"
.FilterIndex = 2
If .Show = -1 Then
oTable.Cell(1, 1).Select
For Each itm In .SelectedItems
With Selection
.InlineShapes.AddPicture FileName:=itm, _
LinkToFile:=False, SaveWithDocument:=True, Range:=Selection.Range
tmp = Split(itm, "\")
.MoveRight Unit:=wdCharacter
.TypeText vbCrLf & tmp(UBound(tmp))
.MoveRight Unit:=wdCell
End With
Next itm
End If
End With
If Len(oTable.Rows.Last.Cells(1).Range) = 2 Then
oTable.Rows.Last.Delete
End If
Set fd = Nothing
End Sub
Moet ik hier misschien iets aan aanpassen??
Alvast bedankt voor een antwoord :thumb: