Cusotmize & Event hadling for 'Save As' Dialog box in office 2007

U

uhs

Hello There,
I want to do follwoing thing using c# - .net 2.0 - for word,exce,ppt 2007 Only

Can we call programtically "Save as" dialog box or we need to alwasy call
Document.Save() or SaveAs() method?

On Load of Save As diaglog box can I change the default location from where
user can select the path to save? -i.e My Network Place ,MY Computer,My
Documents

Can I handle the Event like Close of dialog box,OK button click or Cancel
button
click?


regards
Uhs
 
C

Cindy M.

Hi =?Utf-8?B?dWhz?=,

I can't speak for any application except Word
Can we call programtically "Save as" dialog box or we need to alwasy call
Document.Save() or SaveAs() method?
Application.Dialogs(Word.WdDialog.wdDialogFileSaveAs).Show

On Load of Save As diaglog box can I change the default location from where
user can select the path to save? -i.e My Network Place ,MY Computer,My
Documents
Yes, with reservations. It requires late-binding, as this capability is part
of the old Wordbasic, not VBA. In VBA:
Dim dlg as Word.Dialog
Dim userAction as Long 'Integer in .NET Framework
Set dlg = Application.Dialogs(wdDialogFileSaveAs)
'Sometimes required
' SendKeys "{ENTER}"
With dlg
.Name = "Path info here"
userAction = .Display 'doesn't execute, only displays
End With
Can I handle the Event like Close of dialog box,OK button click or Cancel
button click?
'I haven't memorized the returned values for the dialog, you'd have to
test
Select Case userAction
Case 1
Case 0 'usually Cancel
Case -1
Case Else
End Select


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
P

PRinCE

hi cindy.

i'm making a project for my college-a documents manager.
i use winwordcontrol to use word in c#.net. i need to restrict the users
ability to save the documents anywhere they like. what i need is that
whenever they save the document, the saveas dialogbox that pops up should
open a predefined folder and shouldnt allow users to navigate away from this
folder. the problem is that when using winwordcontrol, the saveas box that
pops up is not anything that is coded in the control. rather, it is the
saveas dialog of ms word itself. so what is to be done here? how do i
restrict word's dialogbox's path?

also, can i control the different command bars and options that one normally
sees on the toolbars?

PLZ reply...
 
C

Cindy M.

Hi =?Utf-8?B?UFJpbkNF?=,
i use winwordcontrol to use word in c#.net. i need to restrict the users
ability to save the documents anywhere they like. what i need is that
whenever they save the document, the saveas dialogbox that pops up should
open a predefined folder and shouldnt allow users to navigate away from this
folder. the problem is that when using winwordcontrol, the saveas box that
pops up is not anything that is coded in the control. rather, it is the
saveas dialog of ms word itself. so what is to be done here? how do i
restrict word's dialogbox's path?
I don't know what the "winwordcontrol" is, so I can't be of any help in
relation to that.

As to controlling Save As:

you can't do what you need to do with the built-in dialog box. You need to

1. Trap the documentBeforeSave event and set the display of the UI to False
(that's one of the parameters passed by the event - look at the Help topic).

2. Display your own dialog box where you can control what the user sees and
trap and process what the user does. This could be a Windows Form or possibly
you could use the FileDialogObject provided by the OFFICE (not Word) object
model. The FileDialogObject will not, however, let you confine the user to a
specific folder. You would have enough control, however, to not let the user
leave the dialog box as long as a different folder is selected (you could re-
display, always with the correct folder, until the user does it correctly).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top