Results 1 to 5 of 5

transfer the commands to command promt

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2014
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    2

    transfer the commands to command promt

    Hello,
    I need to transfer two commands to command prompt. The first one is always the same and it calls a command line of another application (BEAM).
    The second command is for the BEAM command line. It is taken from an Excel cell.
    The code I managed to write is transfering only the first command, probably because after execution of the first command command prompt is getting BEAM command line.
    I don't know what to do...

    Public Clipboard As New MSForms.DataObject
    Sub Mymacro()
        Dim DataObj As New MSForms.DataObject
        Dim strContents As String
        Dim strCmd As String
        Dim RetVal, A, fs
            
        Range("A1").Copy
        
        DataObj.GetFromClipboard
        strContents = DataObj.GetText
        strCmd = "cmd.exe /S /K C:\temp\beam-cli.bat"
        
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set A = fs.CreateTextFile("C:\temp\vb.bat", True)
        A.writeline strCmd
        A.writeline strContents
        A.Close
    
        RetVal = Shell("C:\temp\vb.bat", 1)
    
    End Sub
    Last edited by alansidman; 02-20-2014 at 09:27 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Open one command window and execute a series of commands from it.
    By Air_Cooled_Nut in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2014, 11:48 AM
  2. [SOLVED] Command button to transfer between shhets
    By troysie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2013, 02:53 AM
  3. VBA to command prompt - sending multiple commands to same line?
    By JP Romano in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2012, 10:42 AM
  4. Macro for command button to transfer value
    By Strugggler in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-26-2009, 06:27 PM
  5. running unix commands using vba "shell" command on mac OS X
    By fakeleft in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2005, 06:08 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1