Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2023, 02:26 PM
Guessed's Avatar
Guessed Guessed is offline Loop through pages from cursor position to end of pages Windows 10 Loop through pages from cursor position to end of pages Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I think VBA will be relatively straightforward if the shape is always the same. I would be inclined use inline shapes though as it takes a lot of the complexity away.

If you post a sample document showing a couple of the graphics as you expect to see them then I can probably offer some code that would reproduce that from a folder of images.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 12-11-2023, 04:09 PM
nubuki nubuki is offline Loop through pages from cursor position to end of pages Windows 10 Loop through pages from cursor position to end of pages Office 2021
Novice
Loop through pages from cursor position to end of pages
 
Join Date: Dec 2023
Posts: 3
nubuki is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
I think VBA will be relatively straightforward if the shape is always the same. I would be inclined use inline shapes though as it takes a lot of the complexity away.

If you post a sample document showing a couple of the graphics as you expect to see them then I can probably offer some code that would reproduce that from a folder of images.
Basically the rectangular shape should fill the page except the footer then the picture should fill the shape.
I'm using a shape instead of inserting directly because each photo size is dynamic.

I managed to write a vba that fill all shapes in a document with specified pictures:
Code:
Sub FillShapesWithPictures()
    Dim dialog As FileDialog
    Dim selectedFiles As FileDialogSelectedItems
    Dim i As Integer
    
    Set dialog = Application.FileDialog(msoFileDialogFilePicker)
    dialog.Title = "Select multiple JPG files"
    dialog.Filters.Add "JPEG files", "*.jpg; *.jpeg", 1
    
    If dialog.Show = -1 Then
        Set selectedFiles = dialog.SelectedItems
        
        i = 1
        For Each shape In ActiveDocument.Shapes
            If i <= selectedFiles.Count Then
                shape.Fill.UserPicture selectedFiles(i)
                i = i + 1
            Else
                Exit For
            End If
        Next shape
    End If
End Sub
So I use a combination of both vbas then copy the resulting images in shapes as paste them in the main document.
Any way to combine them?

Regards, Nubuki.
Reply With Quote
Reply

Tags
macro, ms-word, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract specific pages (Category) or arrange pages in a mail merge document? kitlwy Mail Merge 7 09-30-2021 04:50 AM
Loop through pages from cursor position to end of pages Number Pages - not total pages, but actual pages. Kiminator321 Word 8 04-29-2020 03:07 PM
Scroll through pages on loop ndearing Word VBA 5 12-17-2015 08:46 AM
Loop through pages from cursor position to end of pages Placing the same object/picture on all pages but on alternative (mirror position) - alceste Drawing and Graphics 1 09-29-2013 06:28 PM
Loop through pages from cursor position to end of pages create letter template with fixed position fields and follow up pages Lynn O'Shea Word 3 05-18-2010 12:32 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:17 PM.


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