Zerotonine Posted August 7, 2008 Posted August 7, 2008 (edited) Hello. I have a new question. I am coding an add-in for MS Word. By pressing a button a Save File Dialog pops up. The user can simply save the current Word file. I have taken two approaches; each has it's own problems. My first approach would look something like this (this is code found in a MSDN tutorial):public void OnAction(IRibbonControl control) { Stream myStream; switch (control.Id) { case "Opslaan": SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Word-document (*.docx)|*.docx|Word 97-2003-werkmap (*.doc)|(*.doc)"; saveFileDialog.FilterIndex = 1; saveFileDialog.RestoreDirectory = true; saveFileDialog.InitialDirectory = @"C:\Temp\waldo"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { if ((myStream = saveFileDialog.OpenFile()) != null) { // I have no idea what to do here } } break; . . . etc. }}The SaveFileDialog pops up, but I can't save the file. I've tried several approaches, but how can I just save the Word document? In this code snippet I can specify the default file location. I tried a different approach, which also pops up a SaveFileDialog and DOES actually save the file. But the problem is I don't know how to change the default save location:this.applicationObject.ActiveDocument.Save();// SaveFileDialog pops up, but starts in My Documents as default location. I'd like to change this...Either approach is OK, but I just want to Save a file in a custom default location. any help is appreciated... Edited August 7, 2008 by Zerotonine
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now