Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2018, 11:44 AM
ksor ksor is offline Placing text and pictures in Word-document ?? Windows 10 Placing text and pictures in Word-document ?? Office 2016
Advanced Beginner
Placing text and pictures in Word-document ??
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 74
ksor is on a distinguished road
Default Placing text and pictures in Word-document ??

Placing text and pictures in a WORD document.



Code:
Public Sub getBilleder(f As Form, bD As Word.Document)
    Dim tbl As DAO.Recordset
    Set tbl = CurrentDb.OpenRecordset("SELECT BILLEDE.*, BILLEDE.PersonID, BILLEDE.Sortering " & _
                                      "FROM BILLEDE WHERE (((BILLEDE.PersonID)=" & Me.PersonID & _
                                      ")) ORDER BY BILLEDE.Sortering;", dbOpenDynaset)
    With tbl
        .MoveFirst
        If .NoMatch Then Exit Sub
        bD.Content.InsertAfter ("Registrerede billeder: " & CrLf(2))
        Do
            bD.Content.InsertAfter (.Fields("Billedtekst") & CrLf(1))
            bD.Shapes.AddPicture (TrimFrom("Right", CurrentDb.Name, "\") & "IMG_files\" & .Fields("Sti til fil"))
           .MoveNext
        Loop Until .EOF
    End With
    Set tbl = Nothing
End Sub
but the text AND the pictures are places on top of earch other.

How can I arrange the text and pictures something like this:

Overall headline "Registrerede billeder: " & CrLf(2)

Text for first picture: .Fields("Billedtekst") < a frame with the picture - the biggest thimbnail>

Text for the second picture: .Fields("Billedtekst") < a frame with the picture - the biggest thimbnail>

and so on for all pictures in the recordset
Reply With Quote
  #2  
Old 02-01-2018, 02:31 PM
macropod's Avatar
macropod macropod is offline Placing text and pictures in Word-document ?? Windows 7 64bit Placing text and pictures in Word-document ?? 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

See, for example: https://www.msofficeforums.com/word-...html#post47919
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-01-2018, 03:24 PM
ksor ksor is offline Placing text and pictures in Word-document ?? Windows 10 Placing text and pictures in Word-document ?? Office 2016
Advanced Beginner
Placing text and pictures in Word-document ??
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 74
ksor is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
WHAT ... do you know the KISNS dogma ?

(Keep It Simple Not Sophisticated !)
Reply With Quote
  #4  
Old 02-02-2018, 12:00 PM
ksor ksor is offline Placing text and pictures in Word-document ?? Windows 10 Placing text and pictures in Word-document ?? Office 2016
Advanced Beginner
Placing text and pictures in Word-document ??
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 74
ksor is on a distinguished road
Default

I think this is "best practice" inserted centered and one by one with text bolow each of them - simple and minimized:

Code:
Public Sub imageInsert(imgPath As String, txt As String, bD As Word.Document)
    Dim ksSel As Selection
    Set ksSel = Word.Application.Selection
    With ksSel
        .EndKey Unit:=wdStory
        .InlineShapes.AddPicture fileName:=imgPath, LinkToFile:=False, SaveWithDocument:=True
        .MoveRight Unit:=wdCharacter, Count:=1
        .TypeParagraph
        .TypeText Text:=txt
        .TypeParagraph
        .MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
        .EndKey Unit:=wdStory
    End With
    Set ksSel = Nothing
End Sub
Reply With Quote
  #5  
Old 02-02-2018, 01:09 PM
macropod's Avatar
macropod macropod is offline Placing text and pictures in Word-document ?? Windows 7 64bit Placing text and pictures in Word-document ?? 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 ksor View Post
I think this is "best practice" inserted centered and one by one with text bolow each of them - simple and minimized:
Hardly. The use of selections instead of range objects is particularly inefficient and generates screen flicker. Furthermore, the whole point of using a table as my code does is so that you can ensure the image and its text can be assured of moving together.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Placing Endnotes in the Middle of a Document lrosebush Word 3 10-24-2016 04:05 PM
Placing text and pictures in Word-document ?? VBA to split word document containing pictures using delimter uday.word Word VBA 5 09-11-2016 05:59 AM
Placing text and pictures in Word-document ?? Formula for Placing Text in A Worksheet Group? Margaret Excel 4 07-17-2016 11:54 PM
Placing text and pictures in Word-document ?? Creating a (shared!) file with CommandButton placing AutoText into the document thmsrox Word VBA 5 07-07-2016 05:04 AM
Placing text and pictures in Word-document ?? Placing Image behind Text Box alexei_lg Word 1 02-07-2012 12:28 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:27 PM.


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