Hi
I am new to VBA and macros, so any help would be greatly appreciated!
I am using a premade word template that my database fills when I pull information.
It is a label template.
I am trying to make a macro to shift one element on this label because I am unable to reformat the template.
When the database fills in the template it autogenerates a QR code (picture).
I need to shift the QR code -6 increments to the left, and also format it so it sits behind the other text on the label. The behind function is important because the QR has a white background that overlaps with the text on the label. Alternatively I would consider cropping the QR code.
I have tried writing my own macro and I was able to convert the image from inline to floating, have also been able to shift the image the -6 to the left.
However when I change the wrap formatting to behind. things go awry. The first page of the document works well, but every page after that only 1 QR code is left visible on the page, and the rest have somehow disappeared.
Any help would be great thank you!
Here is my current VBA code
Code:
Sub QR_Shift()
'
' QR_Shift Macro
'
With ActiveDocument
For i = .InlineShapes.Count To 1 Step -1
With .InlineShapes(i)
If .Type = wdInlineShapePicture Then
.ConvertToShape
End If
End With
Next
For i = 1 To .Shapes.Count
With .Shapes(i)
If .Type = msoPicture Then
.WrapFormat.Type = wdWrapBehind
End If
End With
Next
For Each shap In ActiveDocument.Shapes
shap.Select
With .Shapes
Selection.ShapeRange.IncrementLeft -6
End With
Next
End With
End Sub