Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remote control of Excel from Access (2000 (9.0.6926 SP-3))

    HI!

    I am in the process of automating a number of Excel pivot routines from data supplied from an Access database. I have been using Excel's Macro record facility to reduce the time it takes to build the code required to create and manipulate the pivot tables. For the most part, I have been successful in copying this to Access by adding xlapp. to the start of the code and then executing to achieve the desired results. However, I am finding I am lumbering through this and having to apply a lot of trial and error as not everything wants to work straight off or even at all.

    I.e. One of the problems I have is I want to make a copy of a worksheet. The excel code is:-

    Sheets("USM Pivot").Copy Before:=Sheets(1)

    Currently, I can't get this to work from Access. Seems simple enough though!

    Is there anywhere that has a cross reference list of coding I can refer to? Both the Access and Excel VBA help files on my PC are useless and I'm getting very frustrated!

    Cheers

    Niven

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

    Re: Remote control of Excel from Access (2000 (9.0.6926 SP-3))

    I don't think there is one comprehensive reference list. WendellB's tutorial Automation 101 provides a good introduction with lots of handy links.

    The line of code you mention should refer to the active workbook, so try

    xlapp.ActiveWorkbook.Sheets("USM Pivot").Copy Before:=xlapp.ActiveWorkbook.Sheets(1)

  3. #3
    3 Star Lounger
    Join Date
    Nov 2003
    Location
    London, Gtr London, England
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remote control of Excel from Access (2000 (9.0.6926 SP-3))

    Many thanks for that Hans, I'd just got there with the preverbial trial and error, turning the air blue and thumping the keyboard. Once done this will save a lot of messing around for people, (there's about 8 of these to do), but getting there is so tedious!!!

    Will look at WendellB's tutorial.

    Cheers again,

    Niven <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

Posting Permissions

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