• Footers via VBA (XL XP)

    • This topic has 5 replies, 3 voices, and was last updated 20 years ago.
    Author
    Topic
    #419235

    I am trying to set up some code that changes footers on all the tabs. My code looks like this …
    I’ve replaced the [ and ] with ( and ) so that it doesn’t display the special woody items like grin – how do I turn the tags off?

    	With ActiveSheet.PageSetup
    		.LeftFooter = "&(FILE)"
    		.CenterFooter = "&(TIME)"
    		.RightFooter = "&[DATE]"
    	End With

    Then I run that on the current sheet and then go and look at the results using File, Setup and select the Header/Footer tab, it looks like this …

    If I open the custom footer dialog, it looks like this …

    When I close the custom footer dialog, it looks like this (file name removed) …

    So, as far as I can see, the code I entered is correct but it is not ‘taking’ – any suggestions?

    Viewing 2 reply threads
    Author
    Replies
    • #945966

      You can use the special “tag” tags: [t] will be turned into [ and [/t] will be turned into ]. You can type them yourself, or use TAG from the 1-Click TagPanel.

    • #945967

      The codes you see in the page setup dialog are different from what VBA expects:

          With ActiveSheet.PageSetup
              .LeftFooter = "&F"
              .CenterFooter = "&T"
              .RightFooter = "&D"
          End With
      • #945972

        unbelievable! I was planning to give the user control on the set up of these footers and then copy the footers that they have set up on one tab to all tabs. However, vba returns “&[DATE]” for the date function within a footer but it needs “&D” to initialize the date function within the footer.

        I guess that I will have to scan the users selected footers and replace all “&[DATE]” like items with “&D”.

        Link to the MS KB on XL2000: Inserting and Formatting Text in Headers and Footers

    • #945969

      Try

      .LeftFooter = “&F”
      .CenterFooter = “&T”
      .RightFooter = “&D”

    Viewing 2 reply threads
    Reply To: Footers via VBA (XL XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: