+ Reply to Thread
Results 1 to 3 of 3

It doesn't work in Windows XP?

Hybrid View

  1. #1
    KS Wong
    Guest

    It doesn't work in Windows XP?

    Dear all,

    I have the following codes worked prefectly well in Windows 98 and Windows
    2000.

    with workbooks("Control")
    .worksheets("Main").activate
    end with

    However after I put the excel file onto a Windows XP machine, it does not
    work anymore. I need to put extra code on the top of it.

    workbooks("Control.xls").activate
    with workbooks("Control")
    .worksheets("Main").activate
    end with

    Is this the way how it should be in Windows XP? It would be a nightmare to
    me as I would need to make a lot of modification in my program since there
    would be quite a lot switching between different workbooks in my program.

    Please advise!
    Thanks in advance



  2. #2
    Patrick Molloy
    Guest

    RE: It doesn't work in Windows XP?

    the specified sheet can only be activated if the workbook it belongs to is
    the active workbook. That's true of all O/S platforms. If only one workbook
    is open, then it is, by default, the active workbook. If there are several
    workbooks open, then you need to have the workbook activated.
    Often though, if you're referencing data on a sheet, it isn't necessaryu to
    have the sheet active

    DIM MyArray as Variant
    MyArray = Workbooks("Mybook.xls").Worksheets("sheetx").Range("MyData")

    this code pulls data from a named range into memory; but it does not require
    the workbook or worksheet to be active

    "KS Wong" wrote:

    > Dear all,
    >
    > I have the following codes worked prefectly well in Windows 98 and Windows
    > 2000.
    >
    > with workbooks("Control")
    > .worksheets("Main").activate
    > end with
    >
    > However after I put the excel file onto a Windows XP machine, it does not
    > work anymore. I need to put extra code on the top of it.
    >
    > workbooks("Control.xls").activate
    > with workbooks("Control")
    > .worksheets("Main").activate
    > end with
    >
    > Is this the way how it should be in Windows XP? It would be a nightmare to
    > me as I would need to make a lot of modification in my program since there
    > would be quite a lot switching between different workbooks in my program.
    >
    > Please advise!
    > Thanks in advance
    >
    >


  3. #3
    KS Wong
    Guest

    RE: It doesn't work in Windows XP?

    Dear Patrick,

    Thank you for your advice!
    It is strange that my original code worked fine in Windows 2000 and Windows
    98 but not in Windows XP?

    It seems I need to put extra code on top of it to make it sure.
    Thanks!

    "Patrick Molloy" wrote:

    > the specified sheet can only be activated if the workbook it belongs to is
    > the active workbook. That's true of all O/S platforms. If only one workbook
    > is open, then it is, by default, the active workbook. If there are several
    > workbooks open, then you need to have the workbook activated.
    > Often though, if you're referencing data on a sheet, it isn't necessaryu to
    > have the sheet active
    >
    > DIM MyArray as Variant
    > MyArray = Workbooks("Mybook.xls").Worksheets("sheetx").Range("MyData")
    >
    > this code pulls data from a named range into memory; but it does not require
    > the workbook or worksheet to be active
    >
    > "KS Wong" wrote:
    >
    > > Dear all,
    > >
    > > I have the following codes worked prefectly well in Windows 98 and Windows
    > > 2000.
    > >
    > > with workbooks("Control")
    > > .worksheets("Main").activate
    > > end with
    > >
    > > However after I put the excel file onto a Windows XP machine, it does not
    > > work anymore. I need to put extra code on the top of it.
    > >
    > > workbooks("Control.xls").activate
    > > with workbooks("Control")
    > > .worksheets("Main").activate
    > > end with
    > >
    > > Is this the way how it should be in Windows XP? It would be a nightmare to
    > > me as I would need to make a lot of modification in my program since there
    > > would be quite a lot switching between different workbooks in my program.
    > >
    > > Please advise!
    > > Thanks in advance
    > >
    > >


+ Reply to Thread

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