[VBA: VB6] Using excel from another application

Last update on February 16, 2009 09:23 AM by jak58
Published by jak58

[VBA: VB6] Using excel from another application






Here is a little routine to call Excel from VB6 or another Office application.
Paste in a general module (eg Module1)

In VBA>> Insert>> Module and paste in the window ...
In VB6>> Project>> Add a module, and paste into this window ...

Dim EX As New Application
Public Book As Workbook
Public Sheet As Worksheet


'Don’t forget to add the reference .. 

'Microsoft Excel X,X object librairy


Sub AddExcel () 
     Set EX = CreateObject ( "Excel.Application") 
     EX.Visible = True 
     Set Book = EX.Workbooks.Add 
     'All the functions are available with Application Book 
     Set Sheet = Book.Sheets (1) 
     Example: 
     Sheet.Name = "The Sheet" 
     With Sheet 
         . [A1] = "This is the cell A1" 
         . [A2] = "This is the A2" 
         . Columns ("A:A"). ColumnWidth = 23.14 
     End With 
     'All the functions are available with excel sheet. 
End Sub
Best answers for « Using excel from another application » in :
Connect a database (MDB) to excel Show [VBA] Connecting a database (MDB) to excel Below is a tips of how to connect an Access database (MDB) in an application excel Add reference Microsoft DAO object librairy X.X In a general module (eg Module1) paste the code below...
[Word/Excel] Easily increase the size of a text Show[Word/Excel] Easily increase the size of a text A small trick allowing you to increase size of a text in Office applications, Firefox, Internet Explorer .... Keep the CTRL key on your keyboard then you use the mouse wheel. Depending...
.exe is not a valid Win32 application Show.exe is not a valid Win32 application Downloaded File IDE controller badly configured CD/DVD is unreadable File system corrupt File unregistered Virus/spyware Problem with browser configuration When you launch an executable file,...
How to convert Excel into PDF? ShowHow to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. Step 1 PDF995 is software that gets installed on your computer which enables you to print any sources of document to...
Download Ms Word Excel Cracker ShowMs Word Excel Craker allows recover lost or forgotten passwords for .xls and .doc reated with Microsoft Office 97, 2000, 2003, XP or other word and excel compatible programs. This application will be necessary in case you should have received an...
Download Kernel Excel - Repair Corrupted Excel Documents ShowDescription The application is designed by Nucleus Data Recovery.com Pvt. Ltd. Simple and easy to use, the application offers an intuitive interface. It has been awarded from various popular places. Kernel Excel - Repair Corrupted Excel Documents...
Download XLS (Excel) to DBF Converter ShowDescription The application is designed by WhiteTown Software. XLS (Excel) to DBF Converter is a tool that enables you to convert your XLS files to DBF format quickly and easily. Simple and easy to use, the application has been awarded from various...
Spreadsheets - The Excel Interface ShowExcel Introduction Microsoft Excel is the spreadsheet in the Microsoft Office office suite. To start it, simply click on the appropriate icon in the Start menu (in Windows) or click on an Excel file (that has an .xls file extension). A Excel...
Application Service Provider (ASP) ShowApplication service concept The term ASP (Application Service Provider) refers to the provision, by a provider, of an application which can be used via networks. This term therefore refers to outsourcing of the hosting of an application or an...
Enterprise Application Integration (EAI) ShowIntroduction to the EAI concept The purpose of EAI (Enterprise Application Integration) is the interoperability and organization of the flow of information between heterogeneous applications, i.e. ensure communcation between the different...