Open external file (Hyperlink)

Open external file (Hyperlink)

IgBorges
Contributor Contributor
593 Views
1 Reply
Message 1 of 2

Open external file (Hyperlink)

IgBorges
Contributor
Contributor

Hi

I need open a file Excel through Revit. Similar to hyperlink.

What click the button, it opens the file. (Sorry, my english, i'm from Brazil :D)

Thanks!

 

This is the code, but does not work:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Net;
using System.Windows.Forms;
using System.Windows.Threading;
using System.Data.OleDb;
using System.Diagnostics;

using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;

[TransactionAttribute(TransactionMode.Manual)] 
[RegenerationAttribute(RegenerationOption.Manual)] 
    public class OpenExcelTesoura : IExternalCommand
    {
        static void Main()
        {
            OpenMicrosoftExcel(@"X:\Biblioteca\06 - REVIT\Componentes Revit\Damiani\Estrutural\Treliças\TESOURAS DAMIANI.xlsm");
        }
        static void OpenMicrosoftExcel(string f)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.FileName = "WINEXCEL.EXE";
            startInfo.Arguments = f;
            Process.Start(startInfo);
        }
}

 

0 Likes
594 Views
1 Reply
Reply (1)
Message 2 of 2

Joe.Ye
Alumni
Alumni

 

Note sure which version of Excel you are using,.

For Excel 2010, the executable file name is excel.exe, but not the winexcel.

 

This works fine in my side.

static void OpenMicrosoftExcel(string f)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.FileName = "EXCEL.EXE";
            startInfo.Arguments = f;
            Process.Start(startInfo);
        }



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes