Excel Add-In Require Files
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Excel Add-In Require Files

  1. #1
    Join Date
    Apr 2010
    Posts
    8

    Excel Add-In Require Files

    I am trying to make an Excel add-in. To make this add-in work, I need certain files to be in a certain directly in the C drive. I was wondering how I can put these files into that directly when I publish the add-in. That way, anyone who installs the add-in, will have the correct files in the correct directly.

    Thanks,
    Dennis

  2. #2
    Arjay's Avatar
    Arjay is online now Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,216

    Re: Excel Add-In Require Files

    Write an install program for your app.

    Quote Originally Posted by gberg927 View Post
    To make this add-in work, I need certain files to be in a certain directly in the C drive. I was wondering how I can put these files into that directly when I publish the add-in.
    Why do you need to put files directly in the C drive? What happens if there isn't a C drive? Your app should not rely on any special hardcoded file path to work.

  3. #3
    Join Date
    Apr 2010
    Posts
    8

    Re: Excel Add-In Require Files

    Hey,

    I just used the C drive as an example. I need it to the main drive.

    When you make an excel add-in, you can publish the add-in and it will create an installation exe.

    Pretty much, I want that file to be the only file the user will have to run. That's why I want to put the files in the correct folder in C#.

    Thanks,

  4. #4
    Arjay's Avatar
    Arjay is online now Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,216

    Re: Excel Add-In Require Files

    I don't see the problem. When the add-in is published and the installation exe is created, what goes wrong.

    Files don't get put where they're needed?

    The add-in can't find the files?

    Where are the files ending up and where do you (think you) need them?

    In short, what's the problem?

  5. #5
    Join Date
    Apr 2010
    Posts
    8

    Re: Excel Add-In Require Files

    I am not sure how to actually copy the files to the user's computer. I want them to be in the project, so when an installation exe is created, they are included as well. But I want them to be moved to the correct directory (I assume the easier way to do this would be ribbon_load method).

    Thanks,

  6. #6
    Arjay's Avatar
    Arjay is online now Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,216

    Re: Excel Add-In Require Files

    Not that familar with the Excel addin project, so I created an addin project and added a class library project to the solution (the solution contained ExcelAddin1 and Excel.Text projects). In the ExcelAddin1 project I set a reference to the Excel.Text project.

    I created a simple utility class in the Excel.Text project...
    Code:
        public static class Utility
        {
            public static void Hi() { MessageBox.Show("Hi"); }
    
            public static void Bye( ) { MessageBox.Show( "Bye" ); }
        }
    I modified the standard excel addin class to use the Excel.Test.Utility class.
    Code:
    using Excel.Test;
    using Office = Microsoft.Office.Core;
    
    namespace ExcelAddIn1
    {
      public partial class ThisAddIn
      {
        private static void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
          Utility.Hi( );
        }
    
        private static void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
          Utility.Bye( );
        }
         ...
      }
    }
    I built the solution.

    To publish, I...
    1) Made a Publish folder on my harddrive (this could have been http, ftp, network share, or local). I made it on my local drive.
    2) Clicked on Publish "ExcelAddin1" menu item.
    3) When prompted for the "Specify the location to publish this addin", I choose the local file path (C:\Documents and Settings\hawcor\My Documents\Visual Studio 2008\Projects\ExcelAddIn1\Publish\).
    4) Click Next
    5) Under "What is the default installation path on end user computers?", I selected "From a UNC path or share" (I left the optional unc path edit box blank)
    6) Click Next, click Finish

    Once published, I navigated to the C:\Docu....\...ExcelAddin1\Publish folder and ran Setup.Exe.
    When you run setup, it just registers the addin from the folder you run setup from.

    Next Open Excel. You'll see a message box with "Hi" and "Bye" when closing Excel. If you click Excel Options and the Addin tab, you'll see that the addin was registered from the folder above (e.g. "file:///C:\Docu....\...ExcelAddin1\Publish\ExcelAddin1.vtso")

    To uninstall the addin, go to add/remove programs and select "Remove" for ExcelAddin1.

    At any rate, it successfully published and included the Excel.Text.dll assembly alone with the ExcelAddin1.dll assembly.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center