Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel 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 November 8th, 2009, 02:11 PM
Registered User
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow create and run .bat file

hi..

I need help with a macro in excel which should be able to create and execute a bat file when opened..

the file can just have for example a command to launch notepad or the time..

the objective is basically to check the scurity problems with excel, pdf.. etc..
if you guys have any other ideas in which we can execute code using popular softwares without being detected by anti virus.. chip in your ideas..

thanx a lot :)
 
Old November 9th, 2009, 01:26 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

You can create a simple batch file using Open, Print and Close Commands

Code:
Open "c:\temp.bat" for output as 1
 
Print #1, Echo Off
 
Close #1
will create a batch file

You can execute the batch file from Excel VBA using Shell command.

On the other hand, you can also open the Notepad through shell directly

Code:
Shell "NOTEPAD.exe",vbNormalFocus
To run the macro automatically use Excel's events like Workbook_Open etc

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

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Run bat file as part of Setup project adorable.ashish General .NET 0 March 5th, 2008 07:42 AM
Run a .bat or .exe on server plong Classic ASP Basics 2 May 9th, 2006 06:06 AM
bat file doesn't work maroun BOOK: Beginning Cryptography with Java 1 October 25th, 2005 04:59 PM
Run .bat file from Excel VBA Harold Hawken Excel VBA 2 June 23rd, 2005 03:03 PM





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