Auto Text Entry

D

DKG

Hi,

I have a macro with the following code:

Dim t As Table, c As Cell, i As Long
Set t = ActiveDocument.Tables(1)
For i = t.Columns(1).Cells.Count To 1 Step -1
t.Columns(1).Cells(i).Select
Selection.InsertRowsBelow 1
Next i
Selection.Collapse wdCollapseStart

End Sub

I want to modify this code in spite of "insertion of row"
with insertig a "auto text entry". How can I do this?

Thanks in advance
 
M

Mark Tangard

I can't tell for sure from your post what you mean, but if
you're asking how to insert an AutoText entry using code,
you probably want something like this:

AutoTextEntries("xxxx").Insert Where:=Selection.Range, _
RichText:=True

where xxxx is the name of your AutoText entry.
 
D

DKG

Sir,

You are giving this code last week. The following code to
use inserting a single blank row in a table of 7 column
which has vertically merged cells in column no. 1, 2 and 3
respectively.

I just want to inserting a auto text entry rather than
inserting a row in the following macro (Line No. 6 of
Code). Please give me the solution.
 
D

DKG

Respected Sir,

I just show you what I want :

Data Entry1 : C1 C2 C3 C4 C5 C6 C7
C4 C5 C6 C7
C4 C5 C6 C7
Data Entry2 : C1 C2 C3 C4 C5 C6 C7
C4 C5 C6 C7
C4 C5 C6 C7

I have a document contains a table of 7 columns. There is
vertically cells are merged between Data Entry1 and Data
Entry2 in column no. 1,2 and 3 respectively. There are
single or multiple rows between Data Entry1 and Data
Entry2 and so on.

I want to insert a "AUTO TEXT ENTRY" before Data Entry2.

You gives me the solution last week for inserting a blank
row before Data Entry2. But this time I want to inserting
a Auto Text Entry before Data Entry2. How can I do this?
Kindly advice.

Thanks & Regards
 
M

Mark Tangard

DKG,

You're not making this easy. You need to be more specific
about what you want. I'm guessing your AutoText entry is
a table row. If that's the case, maybe this will do what
you need:

Dim t As Table, i As Long
Set t = ActiveDocument.Tables(1)
For i = t.Columns(1).Cells.Count To 2 Step -1
t.Columns(1).Cells(i).Select
Selection.Collapse wdCollapseStart
NormalTemplate.AutoTextEntries("xxx").Insert _
Where:=Selection.Range, RichText:=True
Selection.MoveUp wdLine, 1
Next i

And if you need the AutoText to follow the last
row also, add this to the end:

t.Range.Select
Selection.Collapse wdCollapseEnd
NormalTemplate.AutoTextEntries("xxx").Insert _
Where:=Selection.Range, RichText:=True

If this isn't what you need, explain it more completely.
And don't finish with "Please give me the solution" or
anything else in a similarly demanding tone. We are not
paid to be here.
 
D

DKG

Respected Mr. Mark Tangard,

Thanks for giving this code. I am just request to you for
give me the solution to help me because I am a beginner in
VBA. Please do not mind as such because you are one of
the "Most Valuable Professional" as certified by Microsoft.

Once again I thanks to you.

DKG
 
H

Heather

Mark
Please don't take DKG's tone the wrong way. He/she is
obviously foreign by the broken English. Until you work
with Slavic folks, you don't realize how they can mix up
our grammar. I'm sure DKG meant, "your help is very
needed" but it comes out as a demand. It took me several
encounters with a coworker from Taiwan and one from the
Ukraine to realize they weren't being rude but didn't
understand the order of words in English.

Just my .02.

Heather (works with many foreign folks)
 
M

Mark Tangard

I do apologize for misinterpreting the 'give me'; I was out
pf line. However, a language-independent problem on these
groups is people not taking the time to explain their goals
clearly. For me probably the most exhausting thing about
answering questions is handling posts that are worded with
little or no attention to conveying the fleshed-out idea.
I had just read one too many that day.
 

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