+ Reply to Thread
Results 1 to 15 of 15

Open txt-file after Macro creating it

  1. #1
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Open txt-file after Macro creating it

    Hello


    I have a macro that creates a txt-file and saves it.

    How can I have the macro open that txt-file once it created and saved it ?


    Please Login or Register  to view this content.

    Thanks !

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Open txt-file after Macro creating it

    Hello
    Try this method
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    Hi YasserKahlil,

    thanks for that. Did you get my PM ?

    The above code needs to be extended with a feature, can you help ?

  4. #4
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    Check this screenshot:

    Screenshot 2017-09-18 13.51.04.png


    You notice those little "o" in Column B. These "o" mark Black&White items.

    The macro that you wrote a few weeks ago would need to be extended with a feature, that, whenever there is an item with an "o" in B, there should be the following line written to the text file before that:


    Please Login or Register  to view this content.

    and after that, the line


    Please Login or Register  to view this content.

    These are Printer settings, so it switches the printer's settings to black&white, and then back to normal.

    I will attach a sample text file, so you can see.
    Attached Files Attached Files
    Last edited by elgato74; 09-18-2017 at 09:10 AM.

  5. #5
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    +++ deleted +++
    Last edited by elgato74; 09-18-2017 at 09:11 AM.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Open txt-file after Macro creating it

    Hello
    Try this code
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    Perfect !! I need to test it some more, but it seems to work really well. Thank you!

  8. #8
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    I just discovered one minor thing.

    It would be best to put the line

    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\192.prs

    to always start with printers' default settings, unless the first item is marked with "o" - then the *sw.prs should appear.

    Everything else should remain the same.

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Open txt-file after Macro creating it

    I don't get the last point. Can you attach some of your expected output?

  10. #10
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    here is the example

    192.prs is the normal printer settings file for color prints
    192sw.prs is the black&white printer settings file for the black&white prints

    If the last item for a printer is black&white, the printer stays that way.

    But I just noticed, that if the last item is marked with the "o" and the macro puts the 192sw.prs in front of it, it also puts a 192.prs after it. So all should be good.

    My idea was to put the normal printer setting file in front of each printer like this:


    c:\(194).printer
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\194.prs
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\ASH-1P.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\DIS-4LP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\EHZ-4LP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\DRK-3P.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\BEZ-MFP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\ACR-MFP.jpg

    c:\(196).printer
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\196.prs
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\BMC-1K.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Magic Cat 1K.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Roulette Pano.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Ali MFP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Bulli V3 MFP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\FCQ-MFP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\CFP-5P.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\ETI-MFP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\ALK-Pano.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\DTB-3P.jpg

    c:\(200).printer
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\200.prs
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\BLS-4erP.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\200sw.prs
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Marilyn V8 3P.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Pacino 3P.jpg
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\200.prs
    C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\Venice V4 1P.jpg
    Last edited by elgato74; 09-18-2017 at 01:03 PM.

  11. #11
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    Hello


    Yes, I need to put the "normal" .prs in front of each batch, like shown above !

    Can you do this for me ?

  12. #12
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Open txt-file after Macro creating it

    Give this a try
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    great, that looks right !

    I will test it tomorrow

    Have a good evening, and thank you again!

  14. #14
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Open txt-file after Macro creating it

    Works great ! Thanks !

  15. #15
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Open txt-file after Macro creating it

    You're welcome. Glad I can offer some 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. [SOLVED] VBA Open File/Run Macro/Close &Save/Open Next File
    By JPSIMMON in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-21-2015, 12:16 PM
  2. Macro - Open File Explorer, Select File, Import certain information from file
    By Drayde in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2015, 08:58 AM
  3. Workbooks.open is creating a file if it does not exist
    By jkj115 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2015, 10:06 AM
  4. Creating Code to open a file whose name changes by week
    By dafigu01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2014, 06:55 PM
  5. [SOLVED] Macro - Master file to import data from another open file with variable file name
    By jdodz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2012, 10:56 PM
  6. macro prompts immediately to open a file once the Excel file with the macro is opened
    By jhmayor03 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2012, 10:00 AM
  7. [SOLVED] Open a file do a macro ( made) and open next succesive file
    By SVTman74 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2006, 05:20 PM

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