Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Open Word app and doc in VBS without showing command window?

$
0
0

   I use VBA in Word and Excel quite a bit, but every now and then Ihave venture into VBS to run something outside of the app.  My way of saying that I know very little about VBS.  In this instance, I needed to create and call a script from within Excel VBA that will open a Word document on a server path, and then save all my Excel files and close them.  The Word doc is a file update menu for my users and has several macros in it that require Excel to be completely closed.

   Anyways, it all works - except for one small hitch.  When the Word doc opens, my users will get a security warning prompt about enabling macros.  There's nothing I can do to prevent this due to corporate IT policies and settings on macro security: anything with macros must be presented with the warning so the user can specifically click Enable or not. 

   That itself is not the problem - it's the command prompt window.  It covers the macro warning.  The script isn't finished until after the doc opens, so the cmd window hangs out, hiding the macro warning.

   Can I modify this VBS script so it runs without showing the command window?

Ed

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("\\Server12\Training\Programs\FileMaintenance\MoveFiles.dotm")
objWord.Visible = True


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>