11-06-2013
Excel VBA script aware of being opened interatively or from the command line
I have a Excel VBA script that automatically runs when opened, extracts one table from a Microsoft Access Database, saves it as CSV, closes it, extracts another, saves it as CSV, closes it, then terminates itself.
Is is called from a short .bat file using the /e option so that Excel does not fully open. The bat file is created on the fly from a JMP/JSL script (JSL from SAS lacks the native ability to equerry access databases).
It works but I am trying to make it idiot proof.
For the sake of the end user (and for me making modifications to a script that closes itself), I'd like the script to be aware of whether it was opened in an interactive Excel session vs. being invoked from the command line (or invoked with the /e option). I want the extraction to run only if invoked in a non-interactive session. If opened in an interactive session, I want to show a help worksheet instead that explains what the script does and where the user should install it.
I cannot figure out anything I can have the script test to make the script be aware whether it is running interactively or non-interactively.
Mike
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
New to unix .. Is there a simple command or utility that will tell me when the last time a file was opened/used? (3 Replies)
Discussion started by: sbr262
3 Replies
2. UNIX for Dummies Questions & Answers
I created a script called title
#!/bin/sh
echo "^0;$*^G"
It will change the terminal window titlebar to what ever I type after the script (title BIG would change titlebar to BIG instead of terminal) Is there a way to make it run so it will work on every terminal window that gets opened.... (1 Reply)
Discussion started by: amason0508
1 Replies
3. Shell Programming and Scripting
I am writing a shell script (runs on HP Unix) which copies files from a source directory to another destination daily. The destination directory always have the files with same name as in the source directory. And daily a new file will be created in the source.
cp command works fine if the file... (1 Reply)
Discussion started by: arunkumar_ms
1 Replies
4. Shell Programming and Scripting
Hi guys,
I am new to Unix, Need your help here.
I have installed cygwin software (Unix) in my computer (Windows vista). Now i want to create a shell script (.sh file)/other script which is equivalent of VBA code (at the bottom) and then put this .sh file into bin directory of c:/cygwin.
so... (7 Replies)
Discussion started by: bansalpankaj88
7 Replies
5. Shell Programming and Scripting
Was wondering what script to run as root that will take as input a filename (full path) that is opened by someone else and force whoever has it opened to close it? Or maybe there is an existing command to do this? Thanks
Edit:
Meant to say file not sheet, too much Excel... (2 Replies)
Discussion started by: stevensw
2 Replies
6. Shell Programming and Scripting
Hi
#Testing for file existence
if ; then
echo 'SCHOOL data is available for processing'
else
echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING'
:
i wrote a script, where it begins by checking if file exists or not.
If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
we want to backup all opened files by vi before editing also with version information. i wrote below alias to backup crontab file content with version info. What i want know is to make this opened files by vi. We want to prevent user mistakes by adding this alias.
alias crontab='DATE=$(date... (4 Replies)
Discussion started by: sebu
4 Replies
9. Shell Programming and Scripting
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies
10. Windows & DOS: Issues & Discussions
I have a VBA that creates a new directory folder and creates a new text file in that directory. I am trying to run a perl script from the VBA and have created a batch file that gets called from the VBA. That bat file uses a shell file to run a script. When the batch file is called I get the error... (0 Replies)
Discussion started by: cmccabe
0 Replies
LEARN ABOUT DEBIAN
excel::template::element::formula
Excel::Template::Element::Formula(3pm) User Contributed Perl Documentation Excel::Template::Element::Formula(3pm)
NAME
Excel::Template::Element::Formula - Excel::Template::Element::Formula
PURPOSE
To write formulas to the worksheet
NODE NAME
FORMULA
INHERITANCE
Excel::Template::Element::Cell
ATTRIBUTES
All attributes a CELL can have, a FORMULA can have, including the ability to be referenced using the 'ref' attribute.
CHILDREN
None
EFFECTS
This will consume one column on the current row.
DEPENDENCIES
None
USAGE
<formula text="=(1 + 2)"/>
<formula>=SUM(A1:A5)</formula>
<formula text="$Param2"/>
<formula>=(A1 + <var name="Param">)</formula>
In the above example, four formulas are written out. The first two have the formula hard-coded. The second two have variables. The third
and fourth items have another thing that should be noted. If you have a formula where you want a variable in the middle, you have to use
the latter form. Variables within parameters are the entire parameter's value.
AUTHOR
Rob Kinyon (rob.kinyon@gmail.com)
SEE ALSO
CELL
perl v5.14.2 2010-06-17 Excel::Template::Element::Formula(3pm)