+ Reply to Thread
Results 1 to 2 of 2

Embedding BASIC Routines in Excel

  1. #1
    Registered User
    Join Date
    09-04-2008
    Location
    U.S.A./Belgium
    Posts
    2

    Embedding BASIC Routines in Excel

    I'm new to Excel/VBA programming. Forgive my naivety. I want to embed BASIC routines within an Excel worksheet but don't know how to go about it.

    Some basic questions (admittedly VERY basic) are how to pass parameters to and from the routine, etc. Can anyone suggest a straightforward source of information on how to get started (or otherwise offer assistance)? Thank you. Denis Sharon

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi Denis,

    Visual Basic code (or Macros if you prefer) are held in the Visual Basic Environment (VBE). This is a 'layer' that's 'attached' to all workbooks and you can get to this in several ways.

    The simplest way is to press ALT-F11. This will open up the VBE and you should see two windows on the left hand side. A 'Project Explorer' window and a 'Properties' window. The Explorer window will list all the objects available for coding - i.e. workbooks and sheets within workbooks. And when you've added other objects, like Code Modules or User Forms you'll also see those listed too.

    For any object you select, the Properties window will show you all the properties that relate to that object, and you can either change the properties by selecting them in the properties window, or programatically by referring to them in code that you write.

    In the VBE choose the 'Insert Module' option from the menu and you'll see a 'Module1' object added to the Explorer window, and your cursor will appear in the code window for the module. From the Menu choose Insert Procedure, or manually start typing in the code window 'Sub MyFantasticNewSub' and enter, and you will have created Procedure in which you can start to add code.

    In the Excel environment you can also right click on an object, or say the sheet tab, and you'll see a 'View Code' option. Clicking this will also open up the VBE and take you directly to the code area that relates to that object.

    There are several books on the shelves that deal with VBA programming for Excel, it's really a matter of personal choice. I found 'Writing Excel Macros' by Steven Roman

    http://www.amazon.com/Writing-Excel-.../dp/1565925874

    useful, along with the Excel VBA Programmers Reference Guide, by Bovey, Bullen and others.

    http://www.amazon.com/Excel-2002-VBA.../dp/0764543717

    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel crashes due to incomplete VBA compilation?
    By RogerN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2009, 09:26 PM
  2. Excel Email Embedding Not Wanted
    By mgsweden78 in forum Excel General
    Replies: 1
    Last Post: 08-27-2008, 01:39 PM
  3. Very Basic Excel Question
    By jstainer in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-26-2008, 05:56 AM
  4. Running Excel 4.0 Macro in Excel 2007.
    By CdSlc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2008, 10:46 AM
  5. Excel 2003 Not Excelling in Handling 2000 .xls File
    By pands in forum Excel General
    Replies: 4
    Last Post: 02-27-2007, 05:56 PM

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