+ Reply to Thread
Results 1 to 8 of 8

Export Excel data into closed workbook

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Export Excel data into closed workbook

    Hello:

    Please refer to attached 2 excel files.
    Source.xls
    Dest_12-01-2013.xls

    Source file will have Daily Receipts for the whole month.
    (I am showing only sample data)

    Both these files will be in C:\Users\Riz\Desktop\Temp location.

    I need a VB Macro to export Data Range E5:G13 from Source file into "Dest_12-01-2013.xls" at B8 without
    opening "Dest_12-01-2013.xls".
    Once data pasted, would like to save "Dest_12-01-2013.xls".

    Eventually, i will be creating files for the whole month and hence i do not wish to open, will do it loop later.

    Please let me know if any questions.

    Thank you

    Riz Momin
    Attached Files Attached Files

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Export Excel data into closed workbook

    Hi, riz,

    AFAIR you cannot write anything into a closed workbook and a given range from Excel VBA directly - AFAIK you would need to open the workbook in question, fulfill the task, close again by using SaveAs.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Export Excel data into closed workbook

    Hi HaHoBe:

    Ok, that's fine....Can you help me get the macro to perform the task.

    Please let me know if any questions.

    Thank you

    Riz Momin

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Export Excel data into closed workbook

    Hi, Riz,

    some questions: would you like to have a dialog for both the files to open, will it always be the range E5:G13 to copy and always be B8 for pasting?

    Ciao,
    Holger

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Export Excel data into closed workbook

    Hello:


    Source range will change but pasting will remain same all the time.

    For 1st day of month source data range would be E5:G13
    For 2nd day of month source data range would be i5:k13 AND SO ON...

    (4 COLUMN INCREASE PER DAY)

    Please let me know if any questions.

    Thank you

    Riz Momin

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Export Excel data into closed workbook

    Hi, Riz Momin,

    I think we´ll have to adapt parts of the macro but anyhow let´s have a start here:

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Export Excel data into closed workbook

    Hello HaHoBe:

    It is not pasting the data in destination file.
    Can you please check the code.

    Thank you

    Riz Momin

  8. #8
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Export Excel data into closed workbook

    Hello HaHoBe:

    I think I am get a good feel of why the error is.
    It's the day # so i think i will be able to figure out.
    Thanks a lot and will let you know if any problem.

    Riz Momin

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Export Excel data into closed workbook

    Hi, Riz,

    instead fo relying on the date you could try and insert an inputbox for checking the area to copy to be more flexible:

    Please Login or Register  to view this content.
    Ciao,
    Holger

+ 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. Export data from closed workbook to active workbook with ADO connection
    By Naresh27 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2013, 01:08 PM
  2. Replies: 12
    Last Post: 07-03-2013, 01:35 PM
  3. Export from active worksheet to closed workbook
    By mbcluck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2009, 10:54 AM
  4. How to export data to a closed Workbook
    By newbie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2005, 05:05 AM
  5. Export data to a closed workbook
    By Luis in forum Excel General
    Replies: 0
    Last Post: 05-21-2005, 09:06 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