Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating a custom table of contents | Microsoft Word Help | |||
After creating custom fields in properties, how do I insert them? | Microsoft Word Help | |||
Creating Custom Page Borders | Microsoft Word Help | |||
custom dictionaries...creating and associating | New Users | |||
Creating Custom Word Templates | Microsoft Word Help |