Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2005

Tip: Looking for answers? Try searching our database.

How Do I......

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry - 15 Jun 2005 13:52 GMT
Anyone,

How can I modify the following macro to repeat the action 20 times?

TIA,
Jerry Porter

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 6/15/2005 by gerald.porter
'
   Selection.Delete Unit:=wdCharacter, Count:=1
   Selection.TypeText Text:=vbTab
   Selection.MoveLeft Unit:=wdCharacter, Count:=1
   Selection.MoveDown Unit:=wdLine, Count:=1
 
End Sub
Chuck - 15 Jun 2005 14:37 GMT
Check out the following in VBA help:
 For...Next statement
 For Each...Next statement
 Do...Loop statement
 While...Wend statement

Your code would need the following:

 Dim x as Long

 For x = 1 to 20
     Selection.Delete Unit:=wdCharacter, Count:=1
     Selection.TypeText Text:=vbTab
     Selection.MoveLeft Unit:=wdCharacter, Count:=1
     Selection.MoveDown Unit:=wdLine, Count:=1
  Next x

> Anyone,
>
[quoted text clipped - 14 lines]
>    
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.