Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 18th, 2009, 04:48 PM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Auto run batch file attached to word-Documents/VBA code is required

Hello every body!

Does any body know how can I make a batch file .bat or exe run automatically and synchronously when I open a word document through VBA code?

Note: this batch file is previously attached to the document. So I need a code to call this batch.

Hoping to see your answer ASAP
Thanks/regards,
 
Old September 20th, 2009, 07:17 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

If you want to run a batch file when the document is opened, you can add a shell command in the Document_Open event of the particular document.

Shell("c:\temp.exe")

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old September 20th, 2009, 07:35 AM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Thanks but it does not work

hello Shasur
Thanks for your reply. I tried this, but it does not work. An error message
appears:
Run time error "53"
File not found.

please note that I attached the batch to the document as an object. It is not existed in C drive , but in the document itself.

I am looking forward for your response.
Thanks/ take care
 
Old September 23rd, 2009, 06:08 PM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Post Where are your comments!!!!!!!!!!

hellllllllloooooooo

I am still waiting . who knows how the code should be, please answer as quick

as possible. Actually I need this for good and defense intention. Someone

attacked and annoyed me with his wicked e-mails. I am planning to delete my

e-mail address from his computer through the batch file.

I have the batch, but I need to convince him to open it. so I decided to attach

it to word file. In this way the batch file runs as he opens the word file.


Please respond, I promise I would not hurt any one through this code.

I am looking forward to receive your solution very soon.
Thanks/regards,





Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a MS DOS Batch file from Excel VBA Louh Excel VBA 1 March 4th, 2008 10:02 PM
Convert a batch file to run in VBscript - WSH issu malcomm VBScript 0 October 25th, 2006 12:35 AM
need detail code to use VBA for word in c# songyonggang C# 0 June 8th, 2006 02:54 AM
Why does Excel VBA code run faster than VB? mambojedi Pro VB 6 3 April 24th, 2006 02:48 PM
Word 2000 VBA code John Stark Excel VBA 0 March 1st, 2006 06:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.