Solved

Hide Word Document Location After Opening The File

Posted on 2009-07-13
9
606 Views
Last Modified: 2013-11-27
I am opening word file through my windows explorer like application made by VB.Net 2008 Express Edition in XP-SP3 platform. Through my interface user double clickes the file and open the document just like windows explorer. In my application the file path is in a network path and which is hidden partially in my program.

e.g. if there is a file in \\a\b\c\d\e.doc, user only able to see the c\d\e.doc portion in my application.

Now my problem is after the word file has opened, if user goes to File Menu->Save As option in that document the entire path is visible. i.e. the \\a\b\c\d\e.doc path is exposed.

Can anyone suggest me any procedure or tricks to hide that portion of that path? I am attaching the following code for your reference which I am using to open a doc file from my application.

Thanking you in advance :-)
Public Function gfOpenFileByProcess(ByVal InFileNameWithPath As String, ByRef OutError As String) As Boolean
        Try
            OutError = ""
            Dim prNew As New Process
 
            prNew.StartInfo.WorkingDirectory = Path.GetDirectoryName(InFileNameWithPath)
            prNew.StartInfo.FileName = Path.GetFileName(InFileNameWithPath)
            prNew.Start()
            prNew.Close()
            Return True
        Catch ex As Exception
            OutError = ex.Message
            Return False
        End Try
    End Function

Open in new window

0
Comment
Question by:Amitava_Mukherjee
  • 4
  • 4
9 Comments
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 450 total points
ID: 24846546
Hello Amitava_Mukherjee,

I think what you ask isn't possible, word shows the path and that's that.   HOWEVER, when opening the file in your interface, you could get the file save as a copy, (temp folder perhaps) open the copy and make your interface show the original path portion.  Now in WOrd they will see the temp path, not quite as you asked but it would hide the root folders.  It is now necessary of course for your interface to upload the temp file to the original folder post edit of course.

Regards,
Chris
0
 

Author Comment

by:Amitava_Mukherjee
ID: 24846699
Your Solution seems interesting to me. Can you elaborate your solution a little more?


If there is any solution which prevent the save as dialog directory selection combo disable that also servs my purpose.
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 450 total points
ID: 24846783
In your I/F:
    1. When user selects a file, copy that file to the temp directory.
    2. You are already displaying the low level folder path so no change here.
    3. You need to keep a note of the file opened so that on closure of word you can trigger the copy.
    4. On word closure when your interface regains the focus you need to copy the changed file back to the parent.
    5. Need to ensure when exiting the I/F that the save is still triggered, additionally may help to check for a file edit on restart and copy across if found.
    6. Previous line implies a record of edits and/or deletion of edited file from temp directory on completion of the copy back.

As for save as, you could have the document save as event handler in the file and as soon as it's triggered set the cancel and/or put up a message accordingly as one option.

Chris
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:Amitava_Mukherjee
ID: 24846839
Hmm, trying ... but in my prgram architecture this is difficult as program ends its job after opening that document. no control of when the user / users will close that, but still a interesting idea no doubt :-), thanx for that.

any idea about how to disable folder selection combo of word saveas dialog?
0
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 450 total points
ID: 24846930
>>> but in my prgram architecture this is difficult as program ends its job after opening ...

Yeah that would be right, you could set a timer to check if the document is still open, and if not to make the copy ... since it is 'now' open loop you would definitely need to double check on next open as well so that if the file pre-exists in the temp directory with a later date to the master that you avoid the copy but still set the timer to check for edit completion.

>>> any idea about how to disable folder selection combo ...

Not especially but it may be possible to disable saveas via policy ... but that would disable it for all usage of Word rather than just your application.

Chris
0
 
LVL 14

Assisted Solution

by:raja_ind82
raja_ind82 earned 50 total points
ID: 24847280
0
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 450 total points
ID: 24847435
raja_ind82

Please read the question : The author requires the path of the current document to be truncated in the WORD application display:
http://www.simplehelp.net/2007/07/28/how-to-set-custom-shortcuts-in-the-windows-xp-save-as-dialog-box/
>>> NOT ...Add a shortcut to the window
http://www.liutilities.com/products/registrybooster/tweaklibrary/tweaks/10162/
>>> NOT ...Disable save as in IE
http://news.cnet.com/8301-13880_3-9861806-68.html
>>> NOT ...The default saveas for Word
http://msdn.microsoft.com/en-us/library/ms646960(VS.85).aspx#_win32_Open_and_Save_As_Dialog_Box_Customization
>>> In this case I can't immediately see if it helps the author so perhaps you can provide the information on how the post assists in suppressing the full file path in the Word save as dialog?

Chris
0
 

Author Comment

by:Amitava_Mukherjee
ID: 24847829
Yes Last One may be the proper solution, I am trying, ive me some time.

I am also trying the following way, is that worth?


dim objWord as Word.application
 
objWord.Documents("Document").commandbars("Menu Bar").Controls("&File").Controls("Save &As...").Enabled = False
 
==================================================================
 
dim CommandShortcuts  as KeyBinding
 
CustomizationContext = objWord.Documents("Document").AttachedTemplate
 
for each CommandShortcuts in keysboundto(wdKeyCategoryCommand,"SaveAs")
CommandShortcuts.disable
next CommandShortcuts

Open in new window

0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 31603147
raja_ind82 and Chris both of you tried to help me and thanx for that. Chris, I am going nearly to your solution. Copying the files to a local directory, using FileSystemWatcher, and trapping whenever the files are midified, I am copying back to my hidden network location. So I am giving you max points :-), however thanx both of you very much for your comments and suggestions
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question