Invoke a script in UNIX using Excel Macro


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Invoke a script in UNIX using Excel Macro
# 1  
Old 01-12-2012
Bug Invoke a script in UNIX using Excel Macro

Hi,

I am using Send Keys to connect to UNIX server and invoke a script .

Is there an alternate way to connect to UNIX server using Excel macro and invoke a UNIX Shell script?

Anu
# 2  
Old 01-12-2012
Depending on your version, I believe there's either a shell() or an exec() call available to allow you to use a local SSH client like putty.

You could probably accomplish it either as a direct call to a specific ssh connection, or wrap it up in a local batch file. Word of caution though, the more external components you fold into the process, the more difficult it would become to support.
# 3  
Old 02-09-2012
Invoke a Script in UNIX througn Excel macro

I have used the following code to connect to UNIX Server.
The connection is successful and the wsTCP.State is 7 .

I need to sudo as a diff user , enter password and invoke a script . Can anyone help?

Option Explicit
Dim sPage As String
Dim wsTCP As OSWINSCK.Winsock
Dim shpGo As OSWINSCK.Winsock


Private Sub Button1_Click()

On Error GoTo ErrHandler
Dim sServer As String
Dim nPort As Long
Dim sBuffer As String
Dim Password As String

Set wsTCP = CreateObject("OSWINSCK.Winsock")
Set shpGo = CreateObject("OSWINSCK.Winsock")

sServer = "servername"
nPort = 22

wsTCP.Protocol = sckTCPProtocol
'wsTCP.Connect sServer, nPort
wsTCP.RemoteHost = "servername"
wsTCP.RemotePort = 22
wsTCP.Connect

Password = InputBox("Type your password here.", "Password Required")
If Password = "" Then
MsgBox "You didn't enter a correct password."
End
End If


MsgBox "Connection Successful"
MsgBox "State: " & wsTCP.State
MsgBox "Status: " & wsTCP.Status
MsgBox "BytesReceived: " & wsTCP.BytesReceived
MsgBox wsTCP.LocalHostName
wsTCP.GetData sBuffer
MsgBox "GetData: " & sBuffer
wsTCP.SendData "sudo as a diff user"
wsTCP.SendData Password

/*execute a script*/


Debug.Print "connect to unix system"

Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & ": " & Err.Description
End Sub
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script solution - running Excel macro in SLES

Hello all, I'm here again with new trouble. I need to find any possible way to apply excel macro on excel file in SLES server, or to convert that macro somehow. Could you please share your ideas, and help me with this? Thank you in advance ps (attached macro is with changed extension,... (14 Replies)
Discussion started by: bigbrobg
14 Replies

2. Windows & DOS: Issues & Discussions

Run UNIX Script from Excel

How to run scripts from Excel and bring results back to excel? (10 Replies)
Discussion started by: santoshdrkr
10 Replies

3. UNIX for Dummies Questions & Answers

UNIX macro....Im new!!

Hey guys, thanks for lookin....my question is I want to create a macro on HPUX to SFTP a .xls to my Windows Server....I have exstensively searched and all I can find is What a macro is not how to create one. Reasoning for having a macro is to put it in a file creation script and have it run at... (7 Replies)
Discussion started by: DStewart
7 Replies

4. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

5. Shell Programming and Scripting

How to write text file data to excel using UNIX shell script?

Hi All, I have the requirement in unix shell script. I want to write the "ls -ltr" command out put to excel file as below. Input :text file data : drwxr-xr-x 5 root root 4096 Oct 2 12:26 drwxr-xr-x 2 apx aim 4096 Nov 29 18:40 drwxr-xr-x 5 root root 4096 Oct 2 12:26 drwxr-xr-x... (10 Replies)
Discussion started by: Balasankar
10 Replies

6. Shell Programming and Scripting

Unix macro help

Hi, I just opened one old RH box and found number of "macros" in there, that how they called in how-to doc, let say you type <rx> and this does a lot of stuff. I can't figure out how it work, how I can edit/display these macros? Can anybody point to the right directions? I have some academic... (3 Replies)
Discussion started by: trento17
3 Replies

7. UNIX for Advanced & Expert Users

Invoke unix script using c program

hi i want to invoke a unix script in a C program and also return some value from the script to the C program to use that value further. Basically i am doing a Lookup operation in this unix script and returning the looked up data from a oracle database table.. please help me invoke as well... (1 Reply)
Discussion started by: somi2yoga
1 Replies

8. Programming

Make-question - redefine a macro, using another macro..?

I think there is no problem to use any macro in a new macro definishion, but I have a problem with that. I can not understand why? I have a *.mak file that inludes file with many definitions and rules. ############################################## include dstndflt.mak ... One of the... (2 Replies)
Discussion started by: alex_5161
2 Replies

9. Shell Programming and Scripting

How to launch a Csh shell script using Excel Macro ?

Hi all. I need to use excel macro at my desktop to launch a csh script which is in a solaris environment. What is the code that i can use in macro to help me with that ? Basically, the code need to telnet or ftp to the solaris environment and just run the script and the macro will output in an... (1 Reply)
Discussion started by: Raynon
1 Replies
Login or Register to Ask a Question