• Open at Specific Sheet (Excel 2002 SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Open at Specific Sheet (Excel 2002 SP2)

    Author
    Topic
    #391231

    Hi

    I have several spreadsheets that open to an Index worksheet, using vba as screenshot, but this one particular Workbook throw up the following error.
    runtime error 2147319784(80028018)
    Method select Object_Worksheet failed

    I don’t understand why!! can anyone help please.

    Thanks Braddy

    Viewing 2 reply threads
    Author
    Replies
    • #698014

      Is “index” a hidden sheet?

      Steve

      • #698015

        Hi

        Steve no it’s not hidden

        Braddy

        • #698023

          I think it’s because “Index” is a reserved word in vba, though I may be wrong….

          Edited Later:

          It seems I’m wrong after all blush I just actually tried it and it works fine for me.

          • #698147

            Hi Brooke

            Yes you can use index I have used it more than once.

            Thanks

            Braddy

            • #698242

              Do you have a case error? “index” should be “Index”?

            • #698482

              when I actuallly tried it, that was my second thought – but case didn’t seem to matter either.

            • #698488

              Hi John

              I’ve tried both

              I’ve even tried renaming the sheet

              Thanks Braddy

    • #698362

      hello Braddy

      Why not use Foglio1 instead of “Index”?

      You named the object for a reason, so why not get the most “Bang” blackhole for your “Buck” money?

      Foglio1 is NOT a key word, at least not in the American version of MS-Excel 2002.

      Alternativly, you may need to give Excel a breathing space by not putting your code in the Workbook Open event. Maybe put the Worksheet….Open line in a module and call that module from the Open event.

      This is from Excel 5.x and I am sure that it still is here since that time. Trust me as far as you can throw me, but it might make things work.

      Wassim

      • #698491

        Hi

        I’ve tried to use the Italian foglio 1 but it still does not work.

        I”m afraid I am not skilled enough to understand the second part of your reply.

        Thanks

        Braddy

        • #698617

          Since foglio1 is an object, the correct syntax would be:

              foglio1.select
          
          • #698813

            Legare

            I followed your suggestion but still get the error

            Thanks

            Braddy

        • #698664

          confused Arrggg Braddy

          I see foglio is an Italian word for Sheet. Arggg. OK do you think you may have a Localization issue? OK here it what I am saying:

          Since MS-Excel comes in many versions that would support many languages, you maybe up against the fact that some objects are called different names in different language versions, so you will need a file, from the Italian version, I don’t remember its name, it might be the *.olb file, and this file tells you what objects are supported with the names in the language of the software.

          Do this for me, run this code and see what you get:

          MsgBox Application.International(xlCountryCode)

          If you get 1 you are using the US Excel, if you get 39, you are using the Italian version, and you can check this

          MSKB article 213833 – XL2000: Creating Macros for Different Language Versions for more codes.

          You can also check MSKB article 211404 – XL2000: Foreign Object Library Files (.olb) for Excel Available to download your Italian *.olb files. You will need two, the Excel one and the VBA one.

          As to the other part of my earlier post, the stuff about having Excel get a breathing room, well in old versions, and some times in new ones, the actions taken during the Open event of the workbook kinda tax the system and thus you want to have the least tasks in that event going on. Disregard for the time being.

          Wassim

          • #698814

            Hi

            Can I first point out that I have at least six of these spreadsheets from Italy and the selext index code works fine for 5 of them leading me to believe Hans when he says the workbook may be corrupted. Having said that how do I run MsgBox Application.International(xlCountryCode) as you suggested.

            Thanks

            Braddy

            • #698825

              Braddy, I don’t think international issues play a part here, but for what it’s worth:
              – activate the Visual Basic Editor (Alt+F11)
              – activate the Immediate window (Ctrl+G)
              – type or paste MsgBox Application.International(xlCountryCode)
              – press Enter

            • #698826

              Hi Hans

              I did as you said but nothing appears to happen!

              Braddy

            • #698834

              The blinking insertion point must be in the line with MsgBox when you press Enter.

            • #698837

              Braddy,

              Try the following:

              – Make a copy of the problem workbook, and work with the copy.
              – Right click a worksheet tab, and select ‘Select All Sheets’.
              – Select all cells (Ctrl+A).
              – Select Edit | Clear | All.
              – Save the copy.

              Does the problem still occur if you re-open the copy?
              If not, there must be some kind of problem in the contents of the worksheets.
              If the problem persists, could you attach the copy to a post (zipped if necessary)? Since you cleared all sheets, they contain no confidential information. (Also check File | Properties and the macros in the workbook for confidential info)

            • #698842

              Hi Hans

              I slightly pre-empted you here, I already copied all the sheets into a new workbook and everything works fine.

              Time to put this thread to bed I think.

              Thanks to everyone who helped with this.

              Braddy

            • #698889

              Congratulations Braddy

              Now you have learned more than you really cared for about the sensitivity of MS-Excel.

              Good Job.

              Lets go home now!

              Wassim

            • #698887

              hello Braddy

              OK yes, the consensus that the workbook may have become corrupted is becoming more and more evident, and this is something very normal, smile it happens to the best of us.

              To run the code I sent you, simply goto the VBE, Visual Basic Editor, by pressing ALT+F11, for example, and copy and paste this line in between a Sub Somename() and End Sub pair.

              Then position the mouse pointer some where between the Sub and End Sub lines, and press F5.

              The workbook corruption should not prohibit you from adding this bit of code, and running it, unless it is that severe, in which case I would suggest that you get a fresh copy of the workbook from your backup set. You do have a BACKUP don’t you?

              Did you have a chance to look at the MSKB articles I quoted?

              Wassim

            • #698890

              Hi Wassim

              I copied all the sheets into a new workbook and everything works fine now.

              Thanks for your patience and assistance.

              Braddy

    • #698375

      You might also try “ThisWorkbook.Worksheets(“Index”).Select.

      • #698492

        Hi Michael

        I tried your suggestion and it gave me a syntax error

        Thanks

        Braddy

        • #698542

          Your experience make me suspect that your workbook is corrupt. The code in itself is OK, and as you wrote, it works without problems in other workbooks.

          What happens if you save the workbook as a HTML (File | Save as Web Page…), then save it as a .xls workbook again?

          • #698561

            Hi Hans

            I did as you suggested and it is still the same, but thanks anyway.

            As I have always been successful with this command before I will assume you are correct about corruption and put this thread to bed.

            Thanks for everyones assistance.

            Braddy

    Viewing 2 reply threads
    Reply To: Open at Specific Sheet (Excel 2002 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: