SUB TrimPaste()
DIM strTarget AS STRING
DIM rngText AS Range
Selection.StartOf Unit:=wdWord,Extend:=wdExtend
Selection.EndOf Unit:=wdWord,Extend:=wdExtend
strTarget =Selection.TEXT
'strTarget =Trim(Selection.Text)
IF LEN(strTarget)<2 THEN
MSGBOX ("Select a word from document.")
END
END IF
IF RIGHT(strTarget,1)=""THEN
Selection.MoveLeft Unit:=wdCharacter,Count:=1,Extend:=wdExtend
END IF
Selection.Copy
END SUB
SUB TrimPaste1()
DIM strTarget AS STRING
DIM rngText AS Range
Selection.StartOf Unit:=wdWord,Extend:=wdExtend
Selection.EndOf Unit:=wdWord,Extend:=wdExtend
strTarget =Selection.TEXT
'strTarget =Trim(Selection.Text)
IF LEN(strTarget)<3 THEN
MSGBOX ("Select more than 3 character.")
END
END IF
Selection.MoveLeft Unit:=wdCharacter,Count:=1,Extend:=wdExtend
IF RIGHT(strTarget,1)=""THEN
Selection.MoveLeft Unit:=wdCharacter,Count:=1,Extend:=wdExtend
END IF
Selection.Copy
END SUB
SUB TrimPaste2()
DIM strTarget AS STRING
DIM rngText AS Range
Selection.StartOf Unit:=wdWord,Extend:=wdExtend
Selection.EndOf Unit:=wdWord,Extend:=wdExtend
strTarget =Selection.TEXT
'strTarget =Trim(Selection.Text)
IF LEN(strTarget)<4 THEN
MSGBOX ("Select more than 4 character.")
END
END IF
Selection.MoveLeft Unit:=wdCharacter,Count:=2,Extend:=wdExtend
IF RIGHT(strTarget,1)=""THEN
Selection.MoveLeft Unit:=wdCharacter,Count:=1,Extend:=wdExtend
END IF
Selection.Copy
END SUB
SUB TrimPaste3()
DIM strTarget AS STRING
DIM rngText AS Range
Selection.StartOf Unit:=wdWord,Extend:=wdExtend
Selection.EndOf Unit:=wdWord,Extend:=wdExtend
strTarget =Selection.TEXT
'strTarget =Trim(Selection.Text)
IF LEN(strTarget)<5 THEN
MSGBOX ("Select more than 5 character.")
END
END IF
Selection.MoveLeft Unit:=wdCharacter,Count:=3,Extend:=wdExtend
IF RIGHT(strTarget,1)=""THEN
Selection.MoveLeft Unit:=wdCharacter,Count:=1,Extend:=wdExtend
END IF
Selection.Copy
END SUB