|
| View previous topic :: View next topic |
| Author |
Message |
Nomey Guest
|
Posted: Thu Nov 29, 2007 3:23 pm Post subject: General macro for running other macros on batches of files? |
|
|
Hi There,
Does anyone know where I could find a snippet of code that executes another Sub in the same Module om a batch of Word files?
Or a macro that executes any other macro (user selected) on a batch of Word files?
Best regards,
Shirley |
|
| Back to top |
|
 |
Google Sponsor

|
Posted: Thu Nov 29, 2007 3:23 pm Post subject: Advertisement |
|
|
|
|
| Back to top |
|
 |
fumei via OfficeKB.com Guest
|
Posted: Thu Nov 29, 2007 6:14 pm Post subject: Re: General macro for running other macros on batches of fil |
|
|
As to the first question, you can execute another Sub by Calling it. In fact,
it is a good general idea to do exactly that. Break longish code into
multiple Subs, and Call them. The other Subs can have input arguments.
It is a good idea to do this, as it makes debugging chunks of code MUCH
easier. It also makes reading thing easier, as you are dealing with logical
chunks.
Sub DoLots()
Dim strIn As String
Dim oBM As Bookmark
' yadda yadda...some stuff
' giving value to the string
' setting a bookmark
' WHATEVER
Call DoOtherOne (strIn, oBM)
Call DoSomethingElse
End Sub
Sub DoOtherOne(strBlah As String, ThisBookmark As Bookmark)
' do something with strings and bookmarks
End Sub
Sub DoSomethingElse()
' lots of other crap
End Sub
As for question #2, user selected macros. You could certainly take a user
selected string, and make that a variable, then pass that to the Run method.
Look up the Run method in Help.:
Nomey wrote:
| Quote: | Hi There,
Does anyone know where I could find a snippet of code that executes another Sub in the same Module om a batch of Word files?
Or a macro that executes any other macro (user selected) on a batch of Word files?
Best regards,
Shirley
|
--
Message posted via http://www.officekb.com |
|
| Back to top |
|
 |
fumei via OfficeKB.com Guest
|
Posted: Thu Nov 29, 2007 6:15 pm Post subject: Re: General macro for running other macros on batches of fil |
|
|
Sorry, but if you are asking HOW to execute action on a number of files, that
is a different thing.
Use the Dir function. It works well.
--
Message posted via http://www.officekb.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|