Thank you so much for the starting point! So the code is failing at the "StrRef" stage and I can't figure out why.
I made a few modifications so that if I can figure out what is wrong with the "StrRef" stage it will do most of what I want it to do. I am having trouble figuring out the right way to add in an if statement to only add in (quotations marks and alterations omitted) if those characters are actually omitted. Also, did I add in the past and format function correct?
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Word.range, StrTxt As String, StrRef As String, StrCite As String
Set Rng = Selection.range
With Rng
StrTxt = Trim(.Text)
StrRef = Trim(Split(StrTxt, """")(UBound(Split(StrTxt, """"))))
StrRef = Replace(StrRef, "[", "")
StrRef = Replace(StrRef, "]", "")
StrRef = Replace(StrRef, ". . .", "")
StrRef = Replace(StrRef, "...", "")
StrCite = Trim(Left(StrTxt, Len(StrTxt) - Len(StrRef)))
StrCite = "(" & Chr(147) & Mid(StrCite, 2, Len(StrCite) - 2) & Chr(148) & ")"
End With
Selection.Text = StrRef & " " & StrCite & "(quoations marks and alterations removed)"
PasteAndFormat (wdFormatSurroundingFormattingWithEmphasis)
Application.ScreenUpdating = True
End Sub