![]() |
|
#1
|
|||
|
|||
|
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
Last edited by macropod; 01-06-2023 at 05:26 PM. Reason: Added code tags |
| Tags |
| image, macro, picutre |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How can I create a macro to shift the content of all subsequent footnotes up one position?
|
Atfon | Word VBA | 4 | 03-29-2016 05:51 AM |
Shift Excel Cell after executing a macro for second time
|
LearningMacro | Excel Programming | 2 | 01-08-2015 03:05 PM |
1.image in a table 2.right click 3.menu click format 4.a format column appears
|
OldFatDog | Drawing and Graphics | 1 | 06-13-2014 11:19 PM |
Noob here - I need a shift calendar by days with count of shift.
|
freeman | Excel | 8 | 09-12-2012 08:45 AM |
Vector image format
|
jespestana | Drawing and Graphics | 4 | 11-26-2010 03:51 AM |