+ Reply to Thread
Results 1 to 9 of 9

Problem Printing Headers using Visual Basic

  1. #1
    Registered User
    Join Date
    03-01-2008
    Posts
    8

    Problem Printing Headers using Visual Basic

    I have a macro that sorts various info and prints out several different sheets that need different headers. Everything works except only part of the info is posted into the headers.

    I use the following code:

    Please Login or Register  to view this content.
    And get a page with the following headers:

    Store Daily Pick Date(this part works fine)


    Why are the first two headers only partially entered? This happens to all the other sheets
    Last edited by Paulxlus; 02-14-2014 at 01:19 PM.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Problem Printing Headers using Visual Basic

    Can you clarify what you mean by partially entered? I don't follow...
    I do know that this code:

    Please Login or Register  to view this content.
    Adds the date "&D" and then the letters "ate" as "&D" is the code for the date

  3. #3
    Registered User
    Join Date
    03-01-2008
    Posts
    8

    Re: Problem Printing Headers using Visual Basic

    The date is OK as long as I leave it as "&Date" I get the date, if I use "&D" I get nothing. It's the left and centre header that is giving me problems. The left header should read "Store # 1" but all I get is "Store". The centre header should read "Daily Pick List" but comes up "Daily Pick". I'm using Office 2010 and never needed to put headers into VB before.
    Last edited by Paulxlus; 02-14-2014 at 03:11 PM.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Problem Printing Headers using Visual Basic

    Odd, I'm in office 2010 also, and have no issues with your code...
    Are you getting a printout with partial headers, or are you actually checking the headers on the spreadsheet?
    Also, if you put the headers in manually, does it take?

    EDIT: try removing the Application.printcommunication statements, does it still do the same? I forgot I ommitted that, and if I enter that part of the code I get the same as you. If you do remove the "Aplication.PrintCommunication" statements, you will have to change &Date to &D
    Last edited by Arkadi; 02-14-2014 at 03:26 PM.

  5. #5
    Registered User
    Join Date
    03-01-2008
    Posts
    8

    Re: Problem Printing Headers using Visual Basic

    What appears on the sheet is what I'm getting in print. Also, if I go to the page layout tab and check the print headers they are as they appear on the page. I do agree that "&D" should be the code for the date but why "&Date" works I have no idea.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Problem Printing Headers using Visual Basic

    Definitely a Application.PrintCommunication issue in my opinion. I know it speeds up pagesetup functions, but it causes too many headaches, so I never use it.

  7. #7
    Registered User
    Join Date
    03-01-2008
    Posts
    8

    Re: Problem Printing Headers using Visual Basic

    I stopped using it and it made no difference

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Problem Printing Headers using Visual Basic

    Got me stumped then... only using Application.Printcommunication = false did I get to duplicate your problem. Srry, will get back to you if I think of something.

    It is set to true when you apply the header now? It wasn't left on False from another section of code?

  9. #9
    Registered User
    Join Date
    03-01-2008
    Posts
    8

    Re: Problem Printing Headers using Visual Basic

    Setting it to true did not solve the problem

+ 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. Printing a sheet in Visual Basic
    By B_Taylor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2008, 07:09 PM
  2. Visual Basic problem
    By spondee in forum Excel General
    Replies: 3
    Last Post: 08-14-2006, 01:50 PM
  3. Can I run Visual Basic procedure using Excel Visual Basic editor?
    By john.jacobs71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2005, 10:25 AM
  4. Printing in Visual Basic
    By bjh96 in forum Excel General
    Replies: 1
    Last Post: 06-17-2005, 04:05 PM
  5. [SOLVED] Visual Basic run-time error when printing from web application...
    By GWS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2005, 01:06 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