wdwrapbehind in Word (2003) VBA
Domanda
Sto avendo problemi a ottenere le mie immagini da avvolgere dietro il testo in Word 2003 usando VBA.Posso usare tutte le altre opzioni di avvolgimento Fine ma quando provo a usare WDWRAPBEHIND ottengo il seguente errore.
"Errore di compilazione: variabile non definita"
Ho avuto una caccia a Google senza fortuna.
Codice:
Dim shape1 As shape
Dim imagePath1 As String
imagePath1 = "C:\image.jpg"
Set shape1 = ActiveDocument.Shapes.AddPicture(imagePath1)
With shape1
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoCTrue
.LockAspectRatio = msoTrue
.WrapFormat.Type = wdWrapBehind
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.Left = InchesToPoints(0.433)
.Top = InchesToPoints(0.413)
End With
.
Qualsiasi aiuto appreacitato!
Cheers, Michael
Soluzione
è riuscito a farlo funzionare aggiungendo queste 4 linee anziché wdwrowpbehind.
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapBoth
.WrapFormat.Type = 3
.ZOrder 5
.
Codice completo:
Dim shape1 As shape
Dim imagePath1 As String
imagePath1 = "C:\image.jpg"
Set shape1 = ActiveDocument.Shapes.AddPicture(imagePath1)
With shape1
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoCTrue
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapBoth
.LockAspectRatio = msoTrue
.WrapFormat.Type = 3
.ZOrder 5
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.Left = InchesToPoints(6.889)
.Top = InchesToPoints(0.374)
End With
. Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow