Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997

Early Binding With Microsoft Excel

Early binding can be done with Excel 5.0 and 7.0 by taking advantage of two bugs in Excel. The first bug cannot do direct early binding. The second bug is an unexposed bug in which to do early binding. Be forewarned that using this method may not be compatible in future versions of Excel. Follow these steps to early bind with the Excel object:
  • Select References from the Tools menu.
  • Select Microsoft Excel 5.0 or Excel 7.0 Object Library:
     [Dim|Private|Public|Global] objXLRoot _
    	as [_ExcelApplication]
    [Dim|Private|Public|Global] objXLApp as Excel.Application
    
  • To initialize the objXLRoot use the New method:
     Set objXLRoot = New [_ExcelApplication]
    
  • This complete code fragment illustrates the technique:
     Private Sub Command2_Click()
    	Dim objXL As Excel.Application
    	Dim objXLRoot As [_ExcelApplication]
    	Dim objWKB As Excel.Workbook
    	Set objXLRoot = New [_ExcelApplication]
    	Set objXL = objXLRoot.Application
    	objXL.Visible = True
    
    	Set objWKB = objXL.Workbooks.Add
    	objWKB.Worksheets(1).Range("A2").Formula = "Hello"
    	objWKB.Parent.ActiveCell.Formula = "Why"
    End Sub
    
    														
    Steven Michell
     
  • Comment and Contribute

     

     

     

     

     


    (Maximum characters: 1200). You have 1200 characters left.

     

     

    Sitemap
    Thanks for your registration, follow us on our social networks to keep up-to-date