Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

General macro for running other macros on batches of files?

 
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming
View previous topic :: View next topic  
Author Message
Nomey
Guest





PostPosted: Thu Nov 29, 2007 3:23 pm    Post subject: General macro for running other macros on batches of files? Reply with 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
Back to top
Google
Sponsor





PostPosted: Thu Nov 29, 2007 3:23 pm    Post subject: Advertisement

Back to top
fumei via OfficeKB.com
Guest





PostPosted: Thu Nov 29, 2007 6:14 pm    Post subject: Re: General macro for running other macros on batches of fil Reply with quote

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





PostPosted: Thu Nov 29, 2007 6:15 pm    Post subject: Re: General macro for running other macros on batches of fil Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming All times are GMT
Page 1 of 1

 
Jump to:  
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
Computer Forum