Hi Cathy,
 
You might even write it so that the file runs with the default
application for that file type wherever the application is installed.
It's better than to hard code the path to Excel because not everyone has
the same installation path or might have different applications to
handle Excel files.


Declare Function FindExecutable Lib "shell32.dll" Alias
"FindExecutableA"
        (ByVal lpFile As String, ByVal lpDirectory As String, lpResult
As String *256) As Integer
Declare Sub Main

Sub Main
    Dim err_code As Integer
    Dim executable_path As String *256
    Dim file_path, file_name As String

        file_path = "C:\"'path to the file
        file_name = "Book1.xls"'name of the file to open

    If FileExists(file_path + file_name) Then
          err_code = FindExecutable(file_name, file_path,
executable_path)        
            Run Program executable_path + "  " + file_path + file_name
    End If
End Sub

Jorge


-----Original Message-----
From: OSullivan. Jerry (IT Solutions) [mailto:[EMAIL PROTECTED] 
Sent: 03 June 2005 15:08
To: Cathy Coldrey; [email protected]
Subject: RE: MI-L MapBasic and Excel

Cathy,

You should be able to pass the name of the excel file as a parameter as
below:

Run program "C:\Program Files\Microsoft Office\Office10\EXCEL.EXE
C:\Book1.xls"

Jerry

-----Original Message-----
From: Cathy Coldrey [mailto:[EMAIL PROTECTED]
Sent: 03 June 2005 14:35
To: [email protected]
Subject: MI-L MapBasic and Excel


 Hi,
I am writting a MapBasic programme that I want to open a document in
Excel as an external document. I can open Excel by using the run
programme comand, but am uncertain how to then open a specific .xls file
at the same time. Has anyone attempted to solve a problem like this
before? If so could you shed some light on the subject? Many thanks
:) Cathy 


* ** *** ** * ** *** ** * ** *** ** * 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. 
Any views or opinions presented are solely those of the author, and do
not necessarily 
represent those of ESB. 
If you have received this email in error please notify the sender. 
 
Although ESB scans e-mail and attachments for viruses, it does not
guarantee 
that either are virus-free and accepts no liability for any damage
sustained 
as a result of viruses. 
 
* ** *** ** * ** *** ** * ** *** ** *


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16665





---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16681

Reply via email to