Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Nat Nat is offline
external usenet poster
 
Posts: 71
Default Creating a custom Macro in 07

Hi,

I know how to create a macro in Word, however, I have a slight twist. What
I am trying to do is create a macro for someone (who does not like menus;
right-click or other) to insert a new row at the end of a word table. I
created a macro but it only adds 1 row, unless I highlight multiple rows when
recording the macro.

If you just highligt number of rows, right click and insert it will insert
X number of new rows. Can that functionality be created via macro as well?

Just curious is all. If it involves too much programming it might be over
my head.

thanks in advance..
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Creating a custom Macro in 07

The recorder is hopeless for a job like this (as it is for many
purposes). It's fairly simple to write the VBA from scratch, like
this:

Sub AddRows()
Dim nRows As Long

If Not Selection.Information(wdWithInTable) Then
Exit Sub
End If

For nRows = 1 To Selection.Rows.Count
Selection.Tables(1).Rows.Add
Next
End Sub


On Tue, 27 Nov 2007 11:03:01 -0800, Nat
wrote:

Hi,

I know how to create a macro in Word, however, I have a slight twist. What
I am trying to do is create a macro for someone (who does not like menus;
right-click or other) to insert a new row at the end of a word table. I
created a macro but it only adds 1 row, unless I highlight multiple rows when
recording the macro.

If you just highligt number of rows, right click and insert it will insert
X number of new rows. Can that functionality be created via macro as well?

Just curious is all. If it involves too much programming it might be over
my head.

thanks in advance..


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Nat Nat is offline
external usenet poster
 
Posts: 71
Default Creating a custom Macro in 07

Jay,

Thanks so much for that bit of code. THAT IS PERFECT, Is there any
literature that you are aware of which I could read that was introductory in
nature? I am no programmer, but I would enjoy basic scripting if possible.
Regardless, I really appreciate your assistance in this matter.

Nat

"Jay Freedman" wrote:

The recorder is hopeless for a job like this (as it is for many
purposes). It's fairly simple to write the VBA from scratch, like
this:

Sub AddRows()
Dim nRows As Long

If Not Selection.Information(wdWithInTable) Then
Exit Sub
End If

For nRows = 1 To Selection.Rows.Count
Selection.Tables(1).Rows.Add
Next
End Sub


On Tue, 27 Nov 2007 11:03:01 -0800, Nat
wrote:

Hi,

I know how to create a macro in Word, however, I have a slight twist. What
I am trying to do is create a macro for someone (who does not like menus;
right-click or other) to insert a new row at the end of a word table. I
created a macro but it only adds 1 row, unless I highlight multiple rows when
recording the macro.

If you just highligt number of rows, right click and insert it will insert
X number of new rows. Can that functionality be created via macro as well?

Just curious is all. If it involves too much programming it might be over
my head.

thanks in advance..


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Creating a custom Macro in 07

See the article "Getting To Grips With VBA Basics In 15 Minutes" at:

http://www.word.mvps.org/FAQs/Macros...csIn15Mins.htm

and other pages on the Word MVP website.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Nat" wrote in message
...
Jay,

Thanks so much for that bit of code. THAT IS PERFECT, Is there any
literature that you are aware of which I could read that was introductory
in
nature? I am no programmer, but I would enjoy basic scripting if
possible.
Regardless, I really appreciate your assistance in this matter.

Nat

"Jay Freedman" wrote:

The recorder is hopeless for a job like this (as it is for many
purposes). It's fairly simple to write the VBA from scratch, like
this:

Sub AddRows()
Dim nRows As Long

If Not Selection.Information(wdWithInTable) Then
Exit Sub
End If

For nRows = 1 To Selection.Rows.Count
Selection.Tables(1).Rows.Add
Next
End Sub


On Tue, 27 Nov 2007 11:03:01 -0800, Nat
wrote:

Hi,

I know how to create a macro in Word, however, I have a slight twist.
What
I am trying to do is create a macro for someone (who does not like
menus;
right-click or other) to insert a new row at the end of a word table. I
created a macro but it only adds 1 row, unless I highlight multiple rows
when
recording the macro.

If you just highligt number of rows, right click and insert it will
insert
X number of new rows. Can that functionality be created via macro as
well?

Just curious is all. If it involves too much programming it might be
over
my head.

thanks in advance..


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup
so all may benefit.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a custom table of contents Barb Cary Microsoft Word Help 4 February 13th 09 09:09 PM
After creating custom fields in properties, how do I insert them? CC in Vancouver Microsoft Word Help 2 September 2nd 06 01:23 AM
Creating Custom Page Borders [email protected] Microsoft Word Help 3 July 31st 06 12:55 AM
custom dictionaries...creating and associating Siuan New Users 1 July 18th 06 05:23 AM
Creating Custom Word Templates Jeph Microsoft Word Help 5 February 7th 05 09:45 PM


All times are GMT +1. The time now is 11:32 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"