Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2011, 07:50 PM
macropod's Avatar
macropod macropod is offline how to use Building Blocks or  controls to add a page Windows 7 32bit how to use Building Blocks or  controls to add a page Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Hi verbster,

The document you referred to has a single table with cells containing Picture and Rich Text Content Controls, but it has no facility for adding a new page full of these.



Assuming your document is constructed with a table containing rows for the Picture and Rich Text Content Controls, the following macro will generate a new pair of rows with these same controls. You'll probably need to redefine the row sizes to suit your needs. Note that the code uses both the CentimetersToPoints and InchesToPoints conversions - you can use either (or neither).
Code:
Sub Demo()
Dim ocel As Cell
With ActiveDocument.Tables(1)
  If MsgBox("Add a new row?", vbYesNo, "Picture Manager") = vbYes Then
    .Range.Rows.Add
    .Rows.Last.Height = CentimetersToPoints(5.75)
    For Each ocel In .Rows.Last.Cells
      ocel.Range.ContentControls.Add (wdContentControlPicture)
    Next
    .Range.Rows.Add
    .Rows.Last.Height = InchesToPoints(0.25)
    For Each ocel In .Rows.Last.Cells
      With ocel.Range.ContentControls
        .Add wdContentControlRichText
        With .Item(1)
          .Tag = "Photo Caption"
          .PlaceholderText = "Type image caption here."
        End With
      End With
    Next
  End If
End With
End Sub
You could also modify the code with a loop to insert a whole page full of these. As coded, the macro already takes care of however many columns there are in the table.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 02-03-2011, 10:50 PM
verbster verbster is offline how to use Building Blocks or  controls to add a page Windows XP how to use Building Blocks or  controls to add a page Office 2007
Novice
how to use Building Blocks or  controls to add a page
 
Join Date: Nov 2008
Posts: 7
verbster is on a distinguished road
Default

Yikes! Thanks for your help, but it's way beyond me. For some reason, I thought this was much easier . . . just a mattter of controls and Quick parts. I had no idea it involved code, which I know nothing about.

Did the person who made the photo contact sheet in the link I included use similar code? Is that how she made it possible to create a new photo contact page by clicking "New Contact Page" under Quick Parts?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Building blocks in 2007 derohanes Office 6 03-05-2011 01:31 PM
how to use Building Blocks or  controls to add a page hide ghosted controls designer PowerPoint 1 01-03-2011 07:11 AM
Pagination/Building Blocks problem ijblack Word 0 12-23-2010 06:06 PM
Word 2007 Building Blocks - difficult to update... Ian Hunneybell Word 0 10-19-2009 06:27 AM
Can't Download Controls BillTheAdmin Project 2 12-05-2005 10:20 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:19 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