Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-06-2023, 10:19 AM
sessilelessile sessilelessile is offline Need a macro that can shift an image and format it Windows 10 Need a macro that can shift an image and format it Office 2016
Novice
Need a macro that can shift an image and format it
 
Join Date: Jan 2023
Posts: 3
sessilelessile is on a distinguished road
Exclamation Need a macro that can shift an image and format it

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
Reply With Quote
 

Tags
image, macro, picutre



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a macro that can shift an image and format it 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
Need a macro that can shift an image and format it Shift Excel Cell after executing a macro for second time LearningMacro Excel Programming 2 01-08-2015 03:05 PM
Need a macro that can shift an image and format it 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
Need a macro that can shift an image and format it Noob here - I need a shift calendar by days with count of shift. freeman Excel 8 09-12-2012 08:45 AM
Need a macro that can shift an image and format it Vector image format jespestana Drawing and Graphics 4 11-26-2010 03:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft