Results 1 to 4 of 4

Thread: Excel and DOS batch files

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    2

    Excel and DOS batch files

    Hi All,
    Head hurts with VB stuff so I thought I would ask all you nice bods
    Is it possible using VB to add a DOS batch file into an Excel macro? Basically am trying to make job easier to spend more time surfin net

    Any help muchly appreciated

    Emu
    I am always in the s**t its just the depth that varies

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Did you try to "shell" it?
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    2
    no as we can't work out? If i can find out will a shell do it?
    I am always in the s**t its just the depth that varies

  4. #4
    Junior Member
    Join Date
    Feb 2004
    Location
    Hull, England
    Posts
    19
    Here is an example of Shell in a Sub-procedure named ShellFromMe(), which should run C:\Autoexec.bat when you include the following line:

    Call ShellFromMe


    Public Sub ShellFromMe()
    On Error Goto ErrorHandlerShell ' trap Shell errors
    Shell "C:\Autoexec.bat", vbNormalFocus
    Exit Sub ' immediately exits this Sub procedure

    ErrorHandlerShell:
    Msg = "Unable to run Autoexec.bat, the Batch file."
    MsgBox Msg, vbExclamation + vbOKOnly, Me.Name
    Resume Next ' resume at the next statement (Exit Sub)
    End Sub


    It is possible for your network administrator to prevent Shell running MS-DOS Batch script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width