Re: Using Visual Basic 6.0 to manipulate data in Excel files

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 02/25/04


Date: Tue, 24 Feb 2004 21:11:29 -0500

You're asking the right question ... it's just that to VB devs, the use of
"API" is typically used when requesting information on accessing the Windows
API. It's not normally used when referring to an application exposing a COM
interface ... that we call the object model.

-- 
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Novice" <6tc1ATqlinkDOTqueensuDOTca> wrote in message 
news:50BE832D-FC2D-4222-8A9F-ADAD4A5DC0C2@microsoft.com...
: That is useful information and I sincerely thank you for providing it. 
However, I think you may have misunderstood my question.  An API is an 
application programming interface - I would like to get Microsoft's 
documentation on their Visual Basic 6 API to access/manipulate/etc Excel 
(2000) files.  I.E. you were not born knowing that there is a namespace out 
there named Excel containing a class named Application.  You had to read 
documentation in order to learn that.  That is the documentation I was 
referring to.  I'm using Visual Basic 6.0 and am trying to write my own 
macros in Excel so that I can press a button in one Excel file "a.xls", then 
have that examine the data in another Excel file "b.xls" (that contains 
worksheets with data in them) and use that data to update the data in a 
third Excel file "c.xls" (specifically in one of the worksheets in that 
Excel file).
:
: I wanted to get access to:
: a) Microsoft's documentation on the Visual Basic 6 
namespaces/classes/methods/etc that are used to access/manipulate/etc Excel 
(2000) files.
: b) A tutorial that could supplement the above information (what I would 
call API documentation)
:
: Since posting my query I have found this tutorial:
: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/web/004.asp
:
: But it is for Office 97.
:
: Thanks for you help and hopefully I am being more clear this time,
: Novice
:
:      ----- Jezebel wrote: -----
:
:      You don't use APIs for this. You create a reference to the Excel 
application
:      object by one of these methods:
:
:      1) Early binding: add the Excel object library to your VB Project >
:      References. The declare and instantiate a reference --
:
:      Dim mXLApp as Excel.Application
:      Set mXLApp as new Excel.Application
:
:
:      2) or use late binding.
:
:      Dim mXLApp as object
:      Set mXLApp = CreateObject("Excel.Application")
:
:
:      The code for manipulating Excel in VB will look much like much like 
Excel
:      VBA code, but applied as methods of the application object. Eg, to 
open a
:      workbook --
:
:      Set pXLBook = mXLApp.Workbooks.Open(pFileName)
:
:
:
:
:
:
:      "Novice" <6tc1ATqlinkDOTqueensuDOTca> wrote in message
:      news:180E5244-9F04-4802-99D7-5E0E4C53D8B5@microsoft.com...
:      > Hi all, I'm new to Visual Basic and am just looking over some 
sample macro
:      code in an Excel file that reads some data from one Excel file 
(specifically
:      data in one of the worksheets in that excel file) and then updates 
the data
:      in the current excel file.  The macro is activate using a button (I 
assume
:      an ActiveX button).
:      >> Anyway, I'm wondering where I can find the API to do this sort of 
work in
:      Visual Basic.  I was able to find this page at Microsoft:
:      >
: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconpart2whatcanyoudowithvisualbasic.asp
:      >> But I'm looking for an API that is Visual Basic code specific to
:      accessing/manipulating/etc Excel files.
:      >> In summary, ideally I'm looking for an Visual Basic API that is 
used
:      specifically used to access/manipulate Excel files.  In addition, 
feel free
:      to direct me to a "good" tutorial on this topic that would supplement 
the
:      API.
:      >> Thanks,
:      > Novice
:
:
: 


Relevant Pages

  • Re: Opening Excel using Shell32 API and running macro
    ... what I need next is to run a specific Macro within this Excel file. ... an API call or leveraging the above API. ... when the application opens it ...
    (microsoft.public.vb.winapi)
  • Re: Save As from Access
    ... Thanks for the response- I was afraid that was the answer! ... link to this page in other responses, but I'm confused as to where to paste ... >> I'm trying to export a query to an Excel file, ... >> like to steer away from API calls if at all possible. ...
    (microsoft.public.access.formscoding)
  • Re: Save As from Access
    ... "Kevin" wrote in message ... > I'm trying to export a query to an Excel file, ... > like to steer away from API calls if at all possible. ...
    (microsoft.public.access.formscoding)
  • Re: Using Visual Basic 6.0 to manipulate data in Excel files
    ... Put simply, Excel doesn't *have* APIs. ... API functions are calls to core ... documentation on their Visual Basic 6 API to access/manipulate/etc Excel ... macros in Excel so that I can press a button in one Excel file "a.xls", ...
    (microsoft.public.vb.general.discussion)
  • Save As from Access
    ... I'm trying to export a query to an Excel file, in a location that the user ... I know the FileDialog command does not support Save As, ... steer away from API calls if at all possible. ...
    (microsoft.public.access.formscoding)