+ Reply to Thread
Results 1 to 1 of 1

Thread: Variables declared as Objects throw error in OFFICE 10 -

  1. #1
    Registered User
    Join Date
    06-20-2011
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    1

    Question Variables declared as Objects throw error in OFFICE 10 -

    I have inherited a legacy Excel app that is crashing in Office 10. The 2 variables in question were originally declared as 'Page' and worked fine in Excel 97-2000. These 2 variables crashed in Excel 2003 and they were changed to 'Object' and ran fine. Now these 2 problem children are causing problems in Office 10.

    I have Googled this issue and haven't found anything useful. I've also researched the Excel Page Object for a better understanding of the object but, the MS site didn't really offer anything insightful. I 'think' this is a relatively simple fix, but, I am in the dark.

    Should these 2 variables be declared as something different or is other code rework in order here? I didn't write the app and would rather not rework it if possible since it's something that all 50 US states use as a federal reporting tool.

    It crashes on stratPage.Visible = True and throws 'Object variable or With block variable not set' error.


    Public Property Let CalculateMode(value As Integer)
        m_CalculateMode = value
    
    ‘ The following 2 variables were originally declared as Page in  Excel Version 97-2000
      '  Dim stPage As Page 
       'Dim stratPage As Page
    
    ‘The following 2 variable declarations were changed to work in Excel 2003
        Dim stPage As Object
        Dim stratPage As Object     
    
        Set stPage = Me.TabBar.Pages.Item("tbPageState")
        stPage.Visible = False
        TabBar.Style = fmTabStyleNone
        
         If value = SSC_StateLevel Then       
            lblWarn.Visible = False
            'frmAllocation.Visible = False
            Me.Caption = "Sample Size Calculator: State Level"
            stPage.Visible = True
            TabBar.value = 0
            
        ElseIf value = SSC_StratumLevel Then
            lblWarn.Visible = True
           	Me.Caption = "Stratum Level Allocation"
            Me.Height = 180
           '**********
            'App CRASHES HERE! 
    
            stratPage.Visible = True
            TabBar.value = 1
        End If     
    
    End Property
    Last edited by romperstomper; 06-20-2011 at 12:14 PM. Reason: code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0