Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2016, 08:02 AM
nando88 nando88 is offline Macro to insert multiple pictures with adjustable column size Windows 10 Macro to insert multiple pictures with adjustable column size Office 2007
Novice
Macro to insert multiple pictures with adjustable column size
 
Join Date: May 2016
Posts: 1
nando88 is on a distinguished road
Default Macro to insert multiple pictures with adjustable column size


I want to be able to insert multiple pictures with a macro, but I want to be able to adjust the column size of the table, and the amount of rows that fit in a single page.
I want to have a dialog appear, that asks for those values.
I am currently using the code from https://www.msofficeforums.com/drawi...ument-all.html but I don't know what to add to make the table size change. I tried to change the values in oTbl in this line:
Code:
Set oTbl = Selection.Tables.Add(Selection.Range, 2, 2)
but that didn't work and I don't know what to change. Can someone please help me?

Thanks in advance
Reply With Quote
  #2  
Old 05-09-2016, 04:04 PM
macropod's Avatar
macropod macropod is offline Macro to insert multiple pictures with adjustable column size Windows 7 64bit Macro to insert multiple pictures with adjustable column size Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted at: [SOLVED] Insert Multiple Pictures Into Table Word With Macro - Page 3
For cross-posting etiquette, please read: A message to forum cross posters - Excelguru

The code in the link you posted also allows you to specify the row heights and, via those, the picture heights.

Kindly provide a cross-post link @ VBA Express and notify them that you've found your answer here.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-09-2016, 08:37 PM
gmayor's Avatar
gmayor gmayor is offline Macro to insert multiple pictures with adjustable column size Windows 10 Macro to insert multiple pictures with adjustable column size Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You might find http://www.gmayor.com/photo_gallery_template.html useful. The table here fits the width between the margins so the column width will be determined by the (selected) number of columns that will fit between the current margins. Images will adapt to the width of the cells and the height is determined by the aspect ratio of the the imported image.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #4  
Old 05-09-2016, 08:52 PM
macropod's Avatar
macropod macropod is offline Macro to insert multiple pictures with adjustable column size Windows 7 64bit Macro to insert multiple pictures with adjustable column size Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by gmayor View Post
The table here fits the width between the margins so the column width will be determined by the (selected) number of columns that will fit between the current margins. Images will adapt to the width of the cells and the height is determined by the aspect ratio of the the imported image.
That's essentially the same as the code in the link I posted does, except that mine also invites the user to nominate the row height. Consequently, not only is the width constrained but so too is the height - useful if you're working with images using a mix of landscape and portrait formats.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-09-2016, 11:02 PM
gmayor's Avatar
gmayor gmayor is offline Macro to insert multiple pictures with adjustable column size Windows 10 Macro to insert multiple pictures with adjustable column size Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Hi Paul
I took a slightly different approach in that the image size is determined by the width of the cells and thus the size of landscape oriented images inserted into the table.

Portrait oriented images match the size of the landscape oriented images in the table, with vertical space added to the cells of landscape images, if there are mixed portrait and landscape images in the same row. Thus all the images are the same size regardless of orientation.

The process also allows for images from different folders to be inserted in the same table and much more.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 05-09-2016, 11:21 PM
macropod's Avatar
macropod macropod is offline Macro to insert multiple pictures with adjustable column size Windows 7 64bit Macro to insert multiple pictures with adjustable column size Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by gmayor View Post
Thus all the images are the same size regardless of orientation.
Only if they have the same aspect ratio or its inverse! (just being picky).
Quote:
Originally Posted by gmayor View Post
The process also allows for images from different folders to be inserted in the same table and much more.
I took more of a KISS approach.

PS: I note your site refers to Google's Picasa. Google discontinued support for Picasa in March this year. For image re-scaling, alternatives include IrfanView.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 05-09-2016, 11:56 PM
gmayor's Avatar
gmayor gmayor is offline Macro to insert multiple pictures with adjustable column size Windows 10 Macro to insert multiple pictures with adjustable column size Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Picassa may be out of support, but it is still widely available and I happen to like it IrfanView is a popular alternative.

The photo gallery software was developed to work primarily with photographs, which tend to have the same aspect ratios. If users need to work with mixed aspect ratios it can be modified, but to date no one has asked for that.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Tags
macro, multiple pics, word 2007

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to insert multiple pictures with adjustable column size Macro to insert multiple pictures to word to a specific size and text wrap mescaL Word VBA 3 11-03-2014 10:51 PM
Macro to insert multiple pictures with adjustable column size Insert values from multiple rows based on value in one column pachmarhi Excel 3 07-18-2014 09:57 PM
Macro to insert multiple pictures with adjustable column size Insert input box into macro to allow user to choose multiple text entries Hoxton118 Word VBA 6 04-03-2014 12:12 AM
How to automatically insert pictures the same size in word 2010 mindblaster Word 2 03-07-2013 11:42 AM
Macro to Insert Text Into Cells Having Multiple Lines revans611 Excel Programming 4 10-24-2011 10:15 AM

Other Forums: Access Forums

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


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