
String date = ("dd.MM.yyyy") ĭocfile_path = Path.Combine(File_path, "test", date) įilename = Path.Combine(docfile_path, "worddoc" + "-" + ".
How to create a folder in word 2007 code#
Here is the code i used: string File_path = docfile_path Adding Alternative Text to Images in Microsoft Word 2007 Web Accessibility 4All Tech Ease: While it may not be the best way to create a web page. You are trying to open the the file that you intent to create? Try using: string date = ("dd.MM.yyyy") Ĥ.I don't see any reason for the line doc = (filename) To create a new Word document and not Document doc = new Document() ģ.you should use a different format for string date, DateTime.ToShortDateString() is dividing the date with the '/' symbol which will create new folders. This is a legal path: string path = is not : string path = can fix it by using the Path.Combine function as follow: docfile_path = Path.Combine(File_path, "test", date) īe sure to this for all path strings (including File_path that is value is not shown in the code above).Ģ.you should use Document doc = () Surprisingly enough, this code compile and run, but the outcome is not what you probably wanted.Ī couple of things is wrong in this code:ġ.you cant add strings like that to create a path, a path should be created with the '/' symbol between directories. Word.Application app = new Word.Application() String date = () įilename = docfile_path + "worddoc"+"-" +".docx" Private void button1_Click(object sender, EventArgs e)

I want to create a folder named as "test" inside this there will be another folder named as today's date "date", i want to keep the the word document inside this date folder, please help. This block of code throws an error called file name is invalid.
