Link to home
Start Free TrialLog in
Avatar of Amitava_Mukherjee
Amitava_MukherjeeFlag for India

asked on

Hide Word Document Location After Opening The File

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

SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Amitava_Mukherjee

ASKER

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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

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