Can I use a switch to truncate/substring a field?

R

rf@absolutions

I am programming a document where I am inserting a character field
(length=25) and I only want the last 4 characters inserted. I am trying to
insert this field into a table and am limited on space.

Word 2003
 
G

Greg

Use "Right"

Sub Test()
Dim pStr As String
pStr = "abcdefghijklmnopqrstuvwxy"
pStr = Right(pStr, 4)
ActiveDocument.Tables(1).Cell(1, 1).Range.Text = pStr
End Sub
 
R

rf@absolutions

The document I am working on is interfacing with any program and I cannot use
the method as you listed below (thanks though). Can anything be done with
switches or formula fields?
 
T

Tony Jollans

I'm confused. You say you are programming, you post in a programming forum,
and now you say you can't use a programming solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top