+ Reply to Thread
Results 1 to 6 of 6

Don't want get open file name and write data on close workbook

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Don't want get open file name and write data on close workbook

    hello
    this macro write data on closed workbook, and i need to change little bit in code,
    i don't want to use GetOpenFileName. I want to set the target workbook always = "Z:\42766\Jan 2 Dec 2014\1.5.14\MasterFile.xlsm"
    I mean when i run this code then this workbook ( "Z:\42766\Jan 2 Dec 2014\1.5.14\MasterFile.xlsm") auto update without getopenfilename
    thanx

    Please Login or Register  to view this content.

  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: Don't want get open file name and write data on close workbook

    Hi, haroon2015,

    with more than 600 posts you should be able to adapt that change on your own .

    Please Login or Register  to view this content.
    I donīt like the Activate and Select part in order to copy data.

    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
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Don't want get open file name and write data on close workbook

    hello, HaHoBe

    this one is becoming yellow

    Please Login or Register  to view this content.
    script out of range

  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: Don't want get open file name and write data on close workbook

    Hi, haroon2015,

    I thought the code was running as you wanted except for the Application.GetOpenFilename? It canīt as there is only one entry for varCopyDest as well as varCopyTarg while whoever adapted the code didnīt consider the number of entries and allowed the code to raise a run-time error when trying to copy for the second (not available) areas.

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

  5. #5
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Don't want get open file name and write data on close workbook

    works perfect as alway

    thanx HaHoBe will add repu


    Ciao,
    Holger

  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: Don't want get open file name and write data on close workbook

    Hi, haroon2015,

    works perfect as alway
    Yes but only as varCopyDest and varCopyTarg are identical, those 2 variables need to be changed/swapped if the areas are different (otherwise the copyto area would be copied and pasted into the copyfrom area).

    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. VBA open file, insert data, close file by tab.
    By Aquabat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2013, 03:37 PM
  2. Transfer Data from Open workbook to Close workbook
    By alexnkc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2013, 10:46 PM
  3. VBA to open a file, update/refresh all data and close file?
    By brianjluke in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-29-2013, 02:27 PM
  4. How to: Open file, format data, save file, close file and repeat.
    By thexeber in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2010, 12:56 PM
  5. [SOLVED] Open CSV file, format data and write output to a text file.
    By BristolBloos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 11:05 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