Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Importing .bas files


"Joel" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Importing .bas files



"Fredrik Wahlgren" wrote:


"Joel" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
importing .prn files jroth Excel Discussion (Misc queries) 2 May 20th 08 03:09 PM
Importing CSV files nnappy Excel Discussion (Misc queries) 1 June 19th 06 06:42 PM
Importing files stina Excel Discussion (Misc queries) 3 March 29th 06 11:14 AM
Importing CSV files Chris Excel Discussion (Misc queries) 4 June 22nd 05 03:02 PM
Importing files Dan E[_2_] Excel Programming 1 July 16th 03 04:53 PM


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"