Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Webmail (Office 2003)

    Hi all,

    I have a question about one of my projects, I created a visual representation of a holiday pick list, I call it the vacation schedule. When I receive an email, with this attachment I open it in web browser. When I use the form I get a global variable error 1004 method Sheets of Object failed. When I copy it to my computer, I do not have that error. I am guessing when I say it has to do with a Global Variable

    HUH



    Private Sub LBDept_Change()
    Dim x As String
    Dim rlocation As Range
    Dim i As Integer
    Set rlocation = Sheets(1).Range("A3")
    Select Case Me.LBDept.Value
    Case "Day shift Press Room"
    Me.lbNAMES.Clear
    i = 1
    Do Until rlocation.Offset(i, 0).Value = ""
    lbNAMES.AddItem rlocation.Offset(i, 0).Value
    i = i + 1
    Loop
    i = 0
    Set rlocation = Sheets(1).Range("A39")
    i = 1
    Do Until rlocation.Offset(i, 0).Value = ""
    lbNAMES.AddItem rlocation.Offset(i, 0).Value
    i = i + 1
    Loop
    Case "Lobster shift Press Room"
    Me.lbNAMES.Clear
    Set rlocation = Sheets(1).Range("A60")
    i = 1
    Do Until rlocation.Offset(i, 0).Value = ""
    lbNAMES.AddItem rlocation.Offset(i, 0).Value
    i = i + 1
    Loop
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Webmail (Office 2003)

    The most obvious problem is that

    End Select

    is missing immediately above End Sub.

    I don't know if it will help if you change the three occurrences of Sheets(1) to ThisWorkbook.Sheets(1). If not, try opening the attachment in a separate Excel window instead of in the browser:
    - In Windows Explorer, select Tools | Folder Options...
    - Activate the File Types tab.
    - Select XLS (Microsoft Excel Worksheet).
    - Click Advanced
    - Clear the check box "Browse in same window".
    - OK your way out.

  3. #3
    New Lounger
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Webmail (Office 2003)

    Thank you Hans,

    "ThisWorkbook.Sheets(1)." did it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •