Results 1 to 5 of 5

Cross reference letter case: Beginning of sentence and middle of sentence

Threaded View

caswell1000 Cross reference letter case:... 02-07-2019, 08:53 AM
Pepe Le Mokko Re: Cross reference letter... 02-07-2019, 09:17 AM
Pepe Le Mokko Re: Cross reference letter... 02-07-2019, 09:19 AM
caswell1000 Re: Cross reference letter... 02-07-2019, 10:06 AM
macropod Re: Cross reference letter... 02-07-2019, 05:25 PM
  1. #1
    Registered User
    Join Date
    02-07-2019
    Location
    Johannesburg
    MS-Off Ver
    2010
    Posts
    2

    Cross reference letter case: Beginning of sentence and middle of sentence

    Afternoon,

    I found this code to change all the cross references to lower case, e.g. "Figure 3 shows ....." becomes "figure 3 shows .....", all cross references change to lower case. I want to add a condition that when the cross reference is in the beginning of a sentence, the case must remain upper case, e.g. ".... after ten years. Figure 3 shows ....." and not ".... after ten years. figure 3 shows ....." but in the middle of a sentence it should be ".... as seen in figure 3..." and not "...as seen in Figure 3..."

    This is the code:

    ```
    Sub FieldRefChanges1()
        On Error Resume Next
        Dim oStoryRng As Range
        Dim oFld As Field
    
        For Each oStoryRng In ActiveDocument.StoryRanges
            For Each oFld In oStoryRng.Fields
              
                If oFld.Type = wdFieldRef And oFld.Result.Words.Count <= 2 Then
                    'add format switch with lowercase option to field codes
                    oFld.Code.Text = oFld.Code.Text & "\* lower "
                    'updates the field results to display the new format
                    oFld.Update
                End If
                
            Next oFld
        Next oStoryRng
    End Sub
    ```

    Please assist.

    Regards
    Caswell1000
    Last edited by caswell1000; 02-07-2019 at 10:08 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Insert value from cell in middle of a sentence
    By jw191 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-22-2019, 12:53 AM
  2. Automatic capital letter for each sentence First letter - how
    By santbiju1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2015, 06:21 AM
  3. Replies: 1
    Last Post: 04-04-2014, 04:25 PM
  4. [SOLVED] Split Capital case and Sentence case from a cell
    By Latha Mani in forum Excel General
    Replies: 8
    Last Post: 03-26-2014, 03:29 AM
  5. [SOLVED] Copying a word from one cell in a different worksheet into the middle of a sentence.
    By DannyJ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2012, 11:18 AM
  6. How do you insert a cell's content in the middle of the sentence?
    By simpleonline1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2010, 02:56 PM
  7. [SOLVED] How do I change case to sentence case in groups in excel?
    By Pinetree in forum Excel General
    Replies: 2
    Last Post: 05-16-2006, 12:10 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1