Consulting

Page 4 of 4 FirstFirst ... 2 3 4
Results 61 to 79 of 79

Thread: Printing macro - impossible?

  1. #61
    Quote Originally Posted by Frosty
    And yes, the MagicMacro I posted will not work, because I suspect you do not have a template called "MyTemplate.dot" at the root of your C:\ drive, and I also suspect you do not have an Autotext entry called "MyEntry"

    In addition, since you are in Word 2003, that code wouldn't work even if you had that template and that autotext entry, because .BuildingBlockEntries only exist in Word 2007/2010.
    I created a template for this purpose, though, I did not have an autotext entry.

    But why would you give me something that you know it wouldn't work for the Word 2003 since I already said I am using the Word 2003?

  2. #62
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Zack,
    I understand that language is a barrier. But you need to take the time to translate the entire post and try to understand it. Don't skip to whatever VBA code in the post, copy, paste, run it and then say "it doesn't work."

    I posted that code as a demonstration of how short the VBA code *could* be. Not as a possible solution. And I didn't remember that you had 2003, or I would have posted code which substituted .BuildingBlockEntries with .AutotextEntries.

    It still would not have worked, however.

  3. #63
    Quote Originally Posted by Frosty
    Well, imagine how difficult it is when someone calls to say "my computer isn't working" and you spend 20 minutes diagnosing all the different things to try, and THEN you discover that the computer is not plugged in.
    Well Frosty, it helps when you actually read what other people have to say, and I wouldn't emphasize it if I haven't already quoted myself on several occasions. I should probably consider using copy paste more often..

    For example:"Hey guys, I am using Word 2003...etc."

    Then comes the reply:"Here's the code, but of course it won't work for the Word 2003".

    I remember a case where a doctor accidentally extracted the wrong kidney from his patient. He wasn't reading a diagnosis carefully. He realised it later though not that it helped his patient in any way.

  4. #64
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Fundamentally, if you can't accomplish a task manually in Microsoft Word (however long it takes), then Microsoft Word VBA cannot provide the solution.

    VBA simply speeds up the tasks you can already accomplish.

    This is why so much of this thread has revolved around trying to find out what YOU can accomplish manually.

    Consider a thread which says "Looking for Word VBA code to build a car engine."

    That would be silly, right? Well, so is this whole thread-- if you cannot manually achieve duplex printing with the printer you currently have.

  5. #65
    Quote Originally Posted by Frosty
    Don't skip to whatever VBA code in the post, copy, paste, run it and then say "it doesn't work."

    I posted that code as a demonstration of how short the VBA code *could* be. Not as a possible solution. And I didn't remember that you had 2003, or I would have posted code which substituted .BuildingBlockEntries with .AutotextEntries.
    Manually putting section and the page I want to print works, but that is not the solution because it has to AUTOMATICALLY determine the last page and print it out. Of course, for the specific section. Lets assume that the document I've posted has 20 pages, and the other one would be the same but with 15 pages. It can also have 50 or 55 pages, it really doesn't matter. What matters is that the VBA automatically determines the last page and prints it out (normal printing). That's it. I can't be more specific than this.
    Basically you open a document, run a macro and the last page of it prints instantly. Then you open another one and the same macro prints the last page of that document as well. You can assume that all documents are similar to the one posted in the other thread.

    And again, fumei posted

    3. print all pages up to the last two pages (1 to x-2)
    4. print last two pages (x + 1) - 2 to x + 1"

    Now, I would be happy to get only the last page print but if you can accomplish putting this in VBA, even better.

    P.S. To answer your questions:

    I am using Word 2003. (which has been stated in the very beginning of this thread)
    Printer is of no issue since a simple print job will do fine as long as there is an option to select the printer from the macro.
    I can't record something that does not exist within the MS Word. You can only select pages you want to print (specific or range) and a section of the document. You can also chose to print a selected text only. There is no option to print the last page only. There is an option called print last page first, but that's about it. I can't tell him / print the last page and the page that precedes it, or print the last page of the section 1 (without manually entering the number of the page) and the first page of the section 2.
    Recording of moving the cursor doesn't help either because the number of pages can vary, as I explained before.

    If you need any additional info I will be more than glad to provide it.

    This is my post in which you have all the necessary info and you haven't even looked at it.

  6. #66
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    I apologize for posting Word 2010 code in a thread where you've already specified you use Word 2003.

    Let's skip to the part of the conversation where we get back to trying to solve your problem. Anecdotes and language barriers aside... the last real post was my description of how the duplex printing process works.

    Does what I posted make sense?

  7. #67
    Quote Originally Posted by Frosty
    I apologize for posting Word 2010 code in a thread where you've already specified you use Word 2003.

    Let's skip to the part of the conversation where we get back to trying to solve your problem. Anecdotes and language barriers aside... the last real post was my description of how the duplex printing process works.

    Does what I posted make sense?
    There is a proverb Medice cura te ipsum.

    Below is my post and I would appreciate it if you would just take some time to read it, if nothing else.

    Manually putting section and the page I want to print works, but that is not the solution because it has to AUTOMATICALLY determine the last page and print it out. Of course, for the specific section. Lets assume that the document I've posted has 20 pages, and the other one would be the same but with 15 pages. It can also have 50 or 55 pages, it really doesn't matter. What matters is that the VBA automatically determines the last page and prints it out (normal printing). That's it. I can't be more specific than this.
    Basically you open a document, run a macro and the last page of it prints instantly. Then you open another one and the same macro prints the last page of that document as well. You can assume that all documents are similar to the one posted in the other thread.

    And again, fumei posted

    3. print all pages up to the last two pages (1 to x-2)
    4. print last two pages (x + 1) - 2 to x + 1"

    Now, I would be happy to get only the last page print but if you can accomplish putting this in VBA, even better.

    P.S. To answer your questions:

    I am using Word 2003. (which has been stated in the very beginning of this thread)
    Printer is of no issue since a simple print job will do fine as long as there is an option to select the printer from the macro.
    I can't record something that does not exist within the MS Word. You can only select pages you want to print (specific or range) and a section of the document. You can also chose to print a selected text only. There is no option to print the last page only. There is an option called print last page first, but that's about it. I can't tell him / print the last page and the page that precedes it, or print the last page of the section 1 (without manually entering the number of the page) and the first page of the section 2.
    Recording of moving the cursor doesn't help either because the number of pages can vary, as I explained before.

    If you need any additional info I will be more than glad to provide it.

  8. #68
    First we have to make sure that you understand what I wrote before we can move along. If that's ok with you?

  9. #69
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Zack,

    You have two options here:
    1) You can try to prove your point, or
    2) you can try to get your problem solved.

    I read your post, I understood it, and I have responded to it already.

    That was my post about you being so certain which things are possible and which are not. My response was contained in the post about using CTRL+G in order to record a macro to go to a specific section or page.

    Now, I'm going to quote myself, and would appreciate a response. If you cannot respond to that, but instead insist on a point I am uninterested in... you can do it on your own in this thread.

    Last chance. Up to you. I harbor no ill-will, but I am becoming bored with trying to help you when you seem disinterested in being helped, and rather more interested in being right.
    I just re-read the beginning of this thread. Your original problem, as best I can see, is the following:
    DocMain.doc has 10 pages.
    DocInsert.doc has 1(?) page.

    You want a single macro which would turn the above state (2 separate documents) into a single printout with...
    DocMain pages 1-9 printed out single-sided
    DocMain page 10 and DocInsert Page 1 printed out duplex.

    In order to do a duplex print job, you need to (at the very least), have a two page document (right?). Because otherwise it doesn't matter whether you have duplex printing turned on or not.

    So for a 10 page document with page 1 of the other document inserted as page 11, and the desire to have page 10 and page 1 printed on the same sheet of paper, you would need to have those pages be perceived by the printers as having page 10 be an "odd" page and the new page 11 be an "even" page, yes?

    Consider a 10 page document printed entirely duplex.

    Pages 1 & 2 will be on the first piece of paper.
    Pages 3 & 4 will be on the second piece of paper, and so on...

    So in an regular duplex job, page 10 and page 11 would *not* be on the same piece of paper, right?

    But if you original document were 9 pages, and you just wanted the new page 10 to be duplex, that would be relatively easy.

    But a 10 page document which becomes an 11 page document, *really* needs to be a 12 page document, with a "blank" page 10, in order to get the duplex job correctly done.

    Does the above make sense?

  10. #70
    Quote Originally Posted by Frosty

    I read your post, I understood it, and I have responded to it already.
    I understand that my questions can be too difficult and that the answers would be more time consuming than a person can afford it so I've decided for the very least I can possibly ask help for.

    A way for a VBA to automatically recognize and print the last page of any document.
    Nevermind sections, duplex etc. This is it. Nothing else.

  11. #71
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Then I will end my participation in this thread with a quote of my own "you cannot help those who do not wish to be helped."

    Good luck!

  12. #72
    Quote Originally Posted by Frosty
    Then I will end my participation in this thread with a quote of my own "you cannot help those who do not wish to be helped."

    Good luck!
    I am sorry you feel that way. I really tried my best in describing my problem and the things I need some help with. I am certain you are a very good VBA programmer and that it was solely my lack of proper terminology in posts that confused you. Still, I am thankful for your time and furthermore, for the things that you taught me about Word 2003 and VBA.

    All the best!

  13. #73
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Zack,

    You are always welcome to come back when you are less upset and respond to the quoted text in post #69 and re-open your question. I believe the other thread addresses your more simple problem of simply printing the last page of a particular section.

    With the new information about using the Go To box, you can also try recording macros to navigate to a specific page and a specific section, and then use the PrintCurrentPage option.

    There are many ways to address this problem, but you do have to be an active participant interested in continuing to learn. I'm not satisfied with this resolution either, but until we can come to a mutual understanding about your required level of understanding and participation in order to achieve a solution which works for you, we are simply banging heads against the wall in our own individual ways.

    All the best to you as well!

    - Jason/Frosty

  14. #74
    Frosty,

    henceforth I will try my best to be an active participant in this forum to learn more about VBA in order to help resolving mine, as well as perhaps issues of others in the future. Pretentious as it may sound, but I truly want to help others as you and the rest have tried to help me.

    Go To box, and recording the macro of it, would do wonders for the documents which would always have the same number of pages and sections. Problem comes when you can't anticipate the exact number of pages for the future documents. However, it is a valuable tool which will already find it's purpose.

    I am satisfied with the resolution of this issue, because I've learnt a lot more than you think. Of course, without your assistance in guiding me I would probably be still walking in the dark, trying to see a simple difference between BuildingBlock and AutoText. Being erudite truly stands for educated individuals who willingly share their abundant knowledge with others who are more than happy to receive some valuable information.

    Best of luck to you in your future endeavours.

    Zack

  15. #75
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Zack,

    The combination of recording macros (to see how to do stuff, i.e., the Go To box) with writing functions to determine values (i.e., the functions in the other thread to determine specific page numbers of a specific section) is why the Go To box is useful, even in documents you don't already know the number of pages. Obviously recording a macro to "go to page 5" is not useful in a 4 page document.

    But being able to understand the macro which "goes to page 5" combined with learning how to, for example, see what page the 3rd table of the document is on can easily be combined into a macro which "automatically prints the page the 3rd table of the document is in."

    This kind of learning is the building block for learning everything you want to know. It is the approach on "how to learn" which is more important than any single answer.

    Hopefully that is something you've taken out of this thread.

    And for the rest... if you come back to this thread, I think you will see that all the components in this thread and the other are actually there for you to be able to solve your original problem. But it is your problem to solve. We will continue to be here to help you solve your problems, but we can't solve them for you.

    Looking forward to your participation.

  16. #76
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    In short, recording macros can serve one or both of the following purposes:
    1) to automate repetitive processes
    2) to provide a launching point for a more advanced macro.

    Don't think recording macros is only for #1. They are also a great tool for simply learning (even if the actual recorded macro is not useful for doing anything).

  17. #77
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    {quote]
    I understand that my questions can be too difficult and that the answers would be more time consuming than a person can afford it so I've decided for the very least I can possibly ask help for.

    A way for a VBA to automatically recognize and print the last page of any document.
    Nevermind sections, duplex etc. This is it. Nothing else.[/quote]Now you are getting insulting. Your questions are not too difficult.

    Yes, there is a way for VBA to print the last page of any document. No duplex, no anything...just the last page. NOT the last page of a section, but the last page of the document - which is what you ask.

    I have posted thousands of lines of code on this site, for hundreds of people, and hundreds of questions (most much more complicated than this stuff), for free. I will not post this for you.

    The code has already been posted here...if you paid enough attention to read it.
    I can't tell him / print the last page and the page that precedes it, or print the last page of the section 1 (without manually entering the number of the page) and the first page of the section 2.
    True. HOWEVER, you have been shown how to get those page numbers. You CAN get the page number of the last page of Section 1, AND the page after it.

    Once you have those numbers...print the darn things.

  18. #78
    Quote Originally Posted by Frosty
    Obviously recording a macro to "go to page 5" is not useful in a 4 page document.
    I believe that the language barrier has already begun to disperse.

    I will read the entire thread again in case I've missed something important, because it seems that I've yearned too much for the solution without paying enough attention to the process of getting to it.

    Thank you for bringing this up to my attention.

  19. #79
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    I think re-reading the thread is a great idea, Zack. There is a lot of good info in this thread (I learned stuff too, which is one of the reasons why I do this).

    I think Paul's original suggestion of field codes to get you a blank page in certain circumstances is actually a great idea in terms of getting your duplex print job to work. I could see a macro which

    1. Prints all the pages of Section 1, except for the last page
    2. Inserts the field codes necessary to give a blank page (or not) in order to get the duplex print job correct
    3. Prints the last page of the section and the newly inserted text from another document as a duplex print job.

    But it would take some testing in your environment as well as a decent understanding of how to put the various pieces together in your environment. I don't actually have a duplex printer I could test this on, but I think you're on your way now to at least finding the various pieces and trying. And that's the most important thing.

    Good luck!

Posting Permissions

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