+ Reply to Thread
Results 1 to 7 of 7

Opening excel work book from access 2016

  1. #1
    Registered User
    Join Date
    06-19-2018
    Location
    Boston
    MS-Off Ver
    2016
    Posts
    40

    Opening excel work book from access 2016

    I am trying to get an excel workbook to open by using vba from access 2016. The code below should work but instead of the document opening up it looks like it opens hidden. It will show up in task manager as opened but nothing will be on my screen. Any idea why this is happening?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: Opening excel work book from access 2016

    There's nothing wrong with the code itself.

    However, if you have some other window open on the screen (in which Excel opens). Excel may open behind that window.
    You could, use Windows API to bring it to the fore...

    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    06-19-2018
    Location
    Boston
    MS-Off Ver
    2016
    Posts
    40

    Re: Opening excel work book from access 2016

    I tried your code and same thing happens. Excel does not open on my screen or show up in the toolbar but if I check task manager it says an excel background process is running but under running apps excel is not showing up. Very weird!
    Last edited by xBxW; 07-17-2018 at 10:56 AM.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: Opening excel work book from access 2016

    Hmm, can't think of reason why it would do that. Tested on 2 different machines (Win7, Excel 64 bit and Win10 Excel 32 bit) on my end, both were able to open the workbook, and bring the window to fore.

    By the way, why do you need to open Excel workbook from Access? Is it for importing data? If so, there is no need to open the workbook.

  5. #5
    Registered User
    Join Date
    06-19-2018
    Location
    Boston
    MS-Off Ver
    2016
    Posts
    40

    Re: Opening excel work book from access 2016

    So I have a certain access report I have scheduled to open at a certain time. I have a macro that starts when access opens. It runs a query, copies the text and then it is supposed to open an excel doc I created that cleans up the query data. So when the excel doc opens it initiates excel to paste the query and then run code to clean up the document and save. Basically this needs to be done every day so I was trying to get it to run at night so I would not have to do it my self every day. If you have a better way of doing what I am trying to accomplish that would be great!

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: Opening excel work book from access 2016

    To do that operation, there is no need to have the opened workbook visible. You just have to ensure code is targeting desired sheet etc using object model.
    Ex: This would copy A1:A10 from left most sheet, to next sheet to right in the workbook in B1:B10 range
    Please Login or Register  to view this content.
    Similar concept applies to all object models in Excel.
    Though, I'm not sure what process is run to clean up the document... I usually prefer to do clean up in query and just export out to Excel.
    To export query to Excel. Refer to link below.
    https://www.mrexcel.com/forum/micros...cel-files.html

  7. #7
    Registered User
    Join Date
    06-19-2018
    Location
    Boston
    MS-Off Ver
    2016
    Posts
    40

    Re: Opening excel work book from access 2016

    Great idea! Thanks for the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 07-10-2018, 07:53 AM
  2. [SOLVED] No value given for one or more parameters - Access 2016 - Excel 2016
    By schulzy175 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-18-2018, 10:11 PM
  3. Current work book .xlsm convert to xlsx work book then mail
    By Vcare in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-26-2016, 09:47 AM
  4. VBA Code for populating cells from one Work Book A to another Work Book with condition
    By ray.kanata in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 06-22-2015, 03:46 PM
  5. Replies: 0
    Last Post: 01-19-2014, 04:01 PM
  6. [SOLVED] running a macro when opening a work book
    By madhatter40 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-23-2013, 05:16 PM
  7. Make a work book readonly on opening?
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2007, 07:48 AM

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