p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Other Office > Word VBA
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 18th, 2009, 05:48 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old September 20th, 2009, 08:17 AM
Friend of Wrox
Points: 1,449, Level: 15
Points: 1,449, Level: 15 Points: 1,449, Level: 15 Points: 1,449, Level: 15
Activity: 17%
Activity: 17% Activity: 17% Activity: 17%
 
Join Date: Sep 2005
Location: , , .
Posts: 420
Thanks: 0
Thanked 14 Times in 14 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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old September 20th, 2009, 08:35 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old September 23rd, 2009, 07:08 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 01:35 AM
need detail code to use VBA for word in c# songyonggang C# 0 June 8th, 2006 03:54 AM
Why does Excel VBA code run faster than VB? mambojedi Pro VB 6 3 April 24th, 2006 03:48 PM
Word 2000 VBA code John Stark Excel VBA 0 March 1st, 2006 06:02 AM



All times are GMT -4. The time now is 12:56 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc