Results 1 to 2 of 2

Run-Time error '91'

Threaded View

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Run-Time error '91'

    Hello
    I'm working on an app developed in VB6 with interaction with Excel VBA
    There are two functions that Utilization properties Excel.Application
    How to use Excel.Application object in both functions?

    ***********************************
    Public Function OpenExcel()
    Dim xl As Object
    
    Set xl = CreateObject("Excel.Application")
    xl.Workbooks.Open ("C:\\excelformat.xls")
    xl.Visible = True
    Set xl = Nothing
    
    End Function
    ***********************************
    ***********************************
    Public Function NewPag()
    Dim xl As Object
    
    Set xl = CreateObject("Excel.Application")
    Line = ActiveCell.Row
    Column = ActiveCell.Column
    Sheets("Plan3").Select
    Range("A1:I48").Select
    xl.Selection.Copy
    Sheets("Plan2").Select
    Range("A" & Line + 3).Select
    ActiveSheet.Paste
    Range(Column & ":" & Line + 5).Select
    Set xl = Nothing
    
    End Function
    ***********************************
    _________________________________________________________
    |Run-time error 91 (Object variable or with block variable not set).|
    _________________________________________________________
    Last edited by arlu1201; 02-14-2013 at 08:48 AM. Reason: Use code tags.

Thread Information

Users Browsing this Thread

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

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