+ Reply to Thread
Results 1 to 5 of 5

Importing .bas files

  1. #1
    Joel
    Guest

    Importing .bas files

    Is there a way to import a function stored in a .bas file into an Excel
    file, without having to switch to the VBA code view and import it? I'm
    looking for an easy way to teach end-users to do it.

    Thanks for your help!

  2. #2
    Bob Phillips
    Guest

    Re: Importing .bas files

    Build a button that runs the macro. You won't get away without code or going
    top the VBE.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Joel" <[email protected]> wrote in message
    news:[email protected]...
    > Is there a way to import a function stored in a .bas file into an Excel
    > file, without having to switch to the VBA code view and import it? I'm
    > looking for an easy way to teach end-users to do it.
    >
    > Thanks for your help!




  3. #3
    Fredrik Wahlgren
    Guest

    Re: Importing .bas files


    "Joel" <[email protected]> wrote in message
    news:[email protected]...
    > Is there a way to import a function stored in a .bas file into an Excel
    > file, without having to switch to the VBA code view and import it? I'm
    > looking for an easy way to teach end-users to do it.
    >
    > Thanks for your help!


    I'm not 1++% sure what you want. Do you want to view the file or do you want
    to run the code?

    /Fredrik



  4. #4
    Joel
    Guest

    Re: Importing .bas files



    "Fredrik Wahlgren" wrote:

    >
    > "Joel" <[email protected]> wrote in message
    > news:[email protected]...
    > > Is there a way to import a function stored in a .bas file into an Excel
    > > file, without having to switch to the VBA code view and import it? I'm
    > > looking for an easy way to teach end-users to do it.
    > >
    > > Thanks for your help!

    >
    > I'm not 1++% sure what you want. Do you want to view the file or do you want
    > to run the code?
    >
    > /Fredrik
    >


    I have a VBA function that I built, and exported it to a .bas file. This
    function can be used in many different spreadsheets by many people. If
    someone has a spreadsheet, currently, they have to:

    1. Right-click on the worksheet name tab.
    2. Click View Code
    3. Make sure Project Explorer is visible.
    4. Right-click in Project Explorer, and click "Import File..."
    5. Browse to the .bas file, and import it.

    From there, it can be run from the Macro menu.

    However, getting into the "View Code" window can be an intimidating (and
    dangerous) place for end-users. I was wondering if there is a way to import
    the .bas file, WITHOUT needing to switch to the "View Code" view? Can it be
    done from the normal Excel user interface somewhere?

  5. #5
    Chip Pearson
    Guest

    Re: Importing .bas files

    Joel,


    You can import a bas file programmatically with code like the
    following:

    ThisWorkbook.VBProject.VBComponents.Import _
    Filename:="H:\Module1.bas"

    For this to work, Excel must have trusted access to the
    VBProject. Go to the Tools menu, choose Options, then Security.
    On the Trusted Sources tab, check the "Trust Access To VBProject"
    setting.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com





    "Joel" <[email protected]> wrote in message
    news:[email protected]...
    > Is there a way to import a function stored in a .bas file into
    > an Excel
    > file, without having to switch to the VBA code view and import
    > it? I'm
    > looking for an easy way to teach end-users to do it.
    >
    > Thanks for your help!




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1