Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2011, 11:03 AM
Registered User
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display Word doc's file path in the title bar but doc title only in Word taskbr item?

I was able to use the VBA code below to display a Word doc's file path in the title bar.

But as a result the file path is also displayed in the Word Windows 7 taskbar item.

How do I get Word to display only the Word doc title in the Windows 7 taskbar instead of the file path? Can anyone give me Word 2010 VBA code for this? Thanks.

Code:
 Sub AutoOpen()

'Display document name and path in the title bar.
ActiveWindow.Caption = ActiveDocument.FullName

End Sub

Sub FileSaveAs()

'Display document name and path in the title bar.

If Dialogs(wdDialogFileSaveAs).Show = 0 Then Exit Sub
System.Cursor = wdCursorNormal

ActiveWindow.Caption = ActiveDocument.FullName

End Sub
 
Old May 15th, 2011, 04:04 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

ActiveDocument.FullName gives the Filename with Path. You can use the following

ActiveDocument.Name to retrieve the filename alone

and

ActiveDocument.Path wlll get you the path of the document alone

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old May 15th, 2011, 04:06 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

ActiveDocument.FullName gives the Filename with Path. You can use the following

ActiveDocument.Name to retrieve the filename alone

and

ActiveDocument.Path wlll get you the path of the document alone

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
url appears in title bar when refreshing shibp2pkumar Classic ASP Basics 3 May 4th, 2005 07:48 PM
convert html doc's to MS word Edwin Reardon VB How-To 1 April 6th, 2005 02:59 PM
How to trap Mouse events on Title bar/Caption bar chiefouko Pro VB.NET 2002/2003 0 September 21st, 2004 02:42 AM
Dynamically write to title bar. fs22 Javascript How-To 2 June 2nd, 2004 04:16 PM
Removing title bar - is this possible? larry HTML Code Clinic 4 January 26th, 2004 03:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.