Print a word doc in folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon,

I would need to be shown how I can using an on_click event print all the
word docs in a folder. The catch is that they contain macro and that they
have to be enabled because one of the macros is used to trap the print
command for customized purposes.

Any help is appreciated!

Thank you

Daniel
 
Dan:

1.) If you are using automation to print word docs and you want the macros
to be enabled, you have to first set Word's default macro security to low.
Not optimal overall, but when its set to low, it ignores whether there's
macros in the document so that you don't have to click anything.

2.) Do a google search on printing Word documents using VBA and Automation,
the code has been posted a zillion times to its not work repeating here.

3.) If you need to loop through all of the documents in a directory, the
following code should get you going, it will dump the file contents of a
directory

HTH
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

----------------begin code-----------------

Public Function DirDump(ByVal strTargetDir As String)
Dim RetString$

If right(strTargetDir, 1) <> "\" Then strTargetDir = strTargetDir & "\"
RetString = Dir(strTargetDir & "*.*")
If Len(RetString) < 1 Then Exit Function

Debug.Print RetString
Do Until Len(RetString) < 1
RetString = Dir()
Debug.Print RetString
Loop
End Function
 
Back
Top