View Single Post
 
Old 10-30-2014, 02:12 PM
noeyeddeer noeyeddeer is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Oct 2014
Posts: 8
noeyeddeer is on a distinguished road
Default

Sorry to be a pain, but I'm getting two issues. The first is that the 'press clip' and 'text link' are not displaying the correct style - where can I insert something like:

PHP Code:
Selection.Style ActiveDocument.Styles("DB_Link"
Into the code to make it format properly?

The second is that I can't seem to insert a paragraph break between the 'text link' and the 'header' of the next section:

Print Item / Text LinkMagnetite project expands on business' solid industry standing
######, Advertising feature 2, 29/10/14, page 10
Building on...operator for the Iron Bridge joint venture.
Print Item / Text Link'Welfare card key to stemming drug funds' as ice threat grows
######, General News, 29/10/14, page 4
THE drug ice is becoming...was not exempt.
Print Item / Text LinkNot joining China-led bank a mistake: Raby


When it should look like this:


Magnetite project expands on business' solid industry standing
######, Advertising feature 2, 29/10/14, page 10
Building on...operator for the Iron Bridge joint venture.
Print Item / Text Link

'Welfare card key to stemming drug funds' as ice threat grows
######, General News, 29/10/14, page 4
THE drug ice is becoming...was not exempt.
Print Item / Text Link



Here is the full code for this operation:

PHP Code:
Sub InsertMergeFields()
'
'   
Inserts the mediaportal data source MergeFields into the documentwith formatting
'
'
    
    
On Error Resume Next
    
    
' HEADLINE
    Selection.Style = ActiveDocument.Styles("Heading 3")
    ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Headline"
    Selection.TypeParagraph
        
   
    ' 
META DATA
    Selection
.Style ActiveDocument.Styles("DB_metadata")
     
Selection.Font.Bold True ' turns bold on
     Selection.Font.Color = RGB(0, 0, 0) = True '
turns black on
    ActiveDocument
.MailMerge.Fields.Add Range:=Selection.RangeName:="Media_Outlet"
    
Selection.TypeText Text:=", "
    
    ' SECTION
    ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="ProgramSection_Name"
    Selection.TypeText Text:=", "
    
    ' 
DATE
    ActiveDocument
.MailMerge.Fields.Add Range:=Selection.RangeName:="Date Date \@ ""dd/MM/yy"""
    
    ' PAGE
       
    ActiveDocument.MailMerge.Fields.AddIf Range:=Selection.Range, MergeField:= _
        "Page_Number", Comparison:=wdMergeIfIsNotBlank, CompareTo:="", _
        TrueAutoText:="MailMergeInsertIf1", TrueText:=", page ", FalseAutoText:= _
        "MailMergeInsertIf2", FalseText:=""
        Selection.Font.Bold = True ' 
turns bold on
        Selection
.Font.Color RGB(000) = True 'turns black on
        ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Page_Number"
        Selection.Font.Bold = False ' 
turns bold off
    
    
' AUDIENCE FOR BROADCAST ITEMS
    Selection.TypeText Text:=", audience: "
    ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Broadcast_Audience_All_People \# ""#,###"""
    
    Selection.TypeText Text:=" (m:"
    ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Broadcast_Audience_Male \# ""#,###"""
    Selection.TypeText Text:=" / "
    Selection.TypeText Text:="f:"
    ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, Name:="Broadcast_Audience_Female \# ""#,###"""
    Selection.TypeText Text:=")"
    
    Selection.TypeParagraph
    
    ' 
EXTRACT
    Selection
.Style ActiveDocument.Styles("DB_Content")
    
ActiveDocument.MailMerge.Fields.Add Range:=Selection.RangeName:="Summary"
    
Selection.TypeParagraph
    
    
' LINKS
    ActiveWindow.View.ShowFieldCodes = True
With Selection
  ' 
URL
  ActiveDocument
.Hyperlinks.Add Anchor:=.RangeAddress:="|"TextToDisplay:="Print Item"
  
.Move Unit:=wdCharacterCount:=-4
  
.End = .End 1
  ActiveDocument
.MailMerge.Fields.Add Range:=.RangeName:="Website_URL"
  
.EndKey Unit:=wdLine
  
.TypeText " / "
  
.EndKey Unit:=wdLine
  
' TEXT LINK URL
  ActiveDocument.Hyperlinks.Add Anchor:=.Range, Address:="|", TextToDisplay:="Text Link"
  .Move Unit:=wdCharacter, Count:=-4
  .End = .End + 1
  ActiveDocument.MailMerge.Fields.Add Range:=.Range, Name:="Text_Link" 
Reply With Quote