Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Opening external file & program via script.
Opening external file & program via script.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Mon 04 Feb 2002 08:36 PM (UTC) |
Message
| I'm feeling a tad lazy about doing the research to answer this myself. I'm betting someone here can answer it for me off the top of their head:
I want to use a script routine to open an MS Excel spreadsheet. At the moment, I am not looking to interact with the spreadsheet via script... I simply want to type an alias to launch Excel with a particular spreadsheet loaded.
The alias should be able to open a file in a defined path. i.e., not in the mushclient directory.
Thanks in advance. :) |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Dubthach
(47 posts) Bio
|
Date
| Reply #1 on Tue 05 Feb 2002 02:39 PM (UTC) |
Message
| I don't know VBScript, but perhaps I can help you on your way. I believe you have to use OLE to do what you want. The best way to find OLE methods and properties is to open Excel, choose Tools -> Macro -> Visual Basic Editor. Then within the Editor, choose View -> Object Browser. The top level Excel object is Excel.Application.
After pooting around a few minutes, I found the objects that I think you need. Here is the code in Perl, you'll have to figure out how to port it to VBScript.
use Win32::OLE;
$Class = "Excel.Application";
$Excel = Win32::OLE -> GetActiveObject( $Class );
if ( !$Excel ) {
$Excel = Win32::OLE -> new( $Class, \&QuitApp )
|| die "Could not create an OLE '$Class' object";
}
$Excel -> Workbooks -> Open("c:/foo/test.xls");
$Excel -> { Visible } = 1;
# Included for completeness.
sub QuitApp {
my( $ComObject ) = @_;
print "Quitting " . $ComObject -> { Name } . "\n";
$ComObject -> Quit();
}
HTH,
Dub | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 06 Feb 2002 01:31 AM (UTC) |
Message
| There are other examples of creating COM objects in VBscript in this forum, see Question regarding the log file for one of them. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
17,424 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top