Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2018, 03:10 PM
macropod's Avatar
macropod macropod is offline can I get bbcodes to format in a page? Windows 7 64bit can I get bbcodes to format in a page? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,381
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


To combine them you could use:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim RngSel As Range, RngTmp As Range, i As Long, j As Long
With Selection
  Set RngSel = .Range
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.Text = "\1"
      .Format = False
      .Forward = True
      .Wrap = wdFindContinue
      .MatchWildcards = True
      .Replacement.ClearFormatting
      .Text = "\[b\](*)\[/b\]"
      .Replacement.Font.Bold = True
      .Execute Replace:=wdReplaceAll
      .Replacement.ClearFormatting
      .Text = "\[i\](*)\[/i\]"
      .Replacement.Font.Italic = True
      .Execute Replace:=wdReplaceAll
      .Replacement.ClearFormatting
      .Text = "\[u\](*)\[/u\]"
      .Replacement.Font.Underline = True
      .Execute Replace:=wdReplaceAll
      .Replacement.ClearFormatting
      .Text = "\[color=0040FF\](*)\[/color\]"
      .Replacement.Font.ColorIndex = &HFF0400
      .Execute Replace:=wdReplaceAll
      .Wrap = wdFindStop
      .Text = "\[list=[0-9]\]*\[/list\]"
      .Replacement.ClearFormatting
      .Replacement.Text = ""
      .Execute
    End With
    Do While .Find.Found
      If .InRange(RngSel) = False Then Exit Do
      i = CLng(Split(Split(.Text, "]")(0), "=")(1)) - 1
      j = 0
      Set RngTmp = .Duplicate
      With .Duplicate
        .Paragraphs.First.Range.Text = vbNullString
        .Paragraphs.Last.Range.Text = vbNullString
        With .Find
          .ClearFormatting
          .Replacement.ClearFormatting
          .Text = "\[\*\]"
          .Replacement.Text = ""
          .Forward = True
          .Wrap = wdFindStop
          .Format = False
          .MatchWildcards = True
          .Execute
        End With
        Do While .Find.Found
          j = j + 1
          If .InRange(RngTmp) = False Then Exit Do
          .Text = i + j & ". "
          .Collapse wdCollapseEnd
          .Find.Execute
        Loop
      End With
      .Collapse wdCollapseEnd
      .Find.Execute
    Loop
  End With
End With
RngSel.Select
Set RngSel = Nothing: Set RngTmp = Nothing
Application.ScreenUpdating = True
End Sub
As for the size, you wouldn't use the &H prefix - you'd simply use whatever the appropriate number is. I have no idea what "the word equivalent of this" is for a given bulletin board's code. You'll need to experiment.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
APA format without cover page or references? SoMany Word 0 03-02-2018 10:36 AM
Running Head AND Page Number on First Page of Document (for APA Format) with Word 2003 DBinSJ Word 3 11-23-2016 11:52 AM
word page format bakhtawar12 Word 1 01-22-2015 07:08 PM
can I get bbcodes to format in a page? Changing page format in document by page fiedlerw01 Word 1 10-23-2012 04:10 AM
Web page format Microsoftenquirer1000 Word 1 10-13-2012 06:38 AM

Other Forums: Access Forums

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