Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header info in macro 2

Status
Not open for further replies.

mscallisto

Technical User
Jun 14, 2001
2,990
US
Visio 2003 and Excel offers no predefined variable to display "path" in the header/footer.

In excel the following macro displays "path".
Whats the Visio way of saying "ActiveWorkbook.Path"

Code:
Sub Set_HeadFoot()
Dim leftBracket, rightBracket As String
leftBracket = "["
rightBracket = "]"
    With ActiveSheet.PageSetup
        .LeftFooter = ActiveWorkbook.Path + "\" + ActiveWorkbook.Name
        .CenterFooter = ""
        .RightFooter = ""
        .RightHeader = leftBracket & Cells(7, 7).Value & rightBracket
        .CenterHeader = ""
        .LeftHeader = ""
    End With
End Sub
 
Try:
ThisDocument.Path

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Thanks johnwm that helped a lot.

With your help I found (ThisDocument.FullName) that shows both path and file.

So now I have:
ThisDocument.Path for path,
ThisDocument.FullName for path and file
and I'm all set.

Curious though I can't find in the DropDownList the item that shows file only.
 
Headers and Footers were added to handle the special case where a drawing page spanned several printed pages. The normal (and more versatile method) is to use background pages.

The selection through the menu is limited for Headers and Footers, but the fields are text fields and VBA can populate them with anything you like.

John... Visio MVP
 
Thanks VisioMVP I didn't now that , I kinda made the assumption that thay were handled like word and excel.

I like visio very much but have much to learn.

Thanks for the insight!
 
During the early versions of Visio, a request was made to add a feature to mark individual pages when a drawing spanned several printed pages. H/Fs were the answer to the request.

If the drawing page is identical to the printed page, the background page has more versatility on what can be printed. Unfortunately, the documentation does not properly reflect this distinction and users familiar with Word and Excel will head for H/F and not even consider background pages.

As they say, Next Version. ;-)

John... Visio MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top