Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create files, but not text files

Status
Not open for further replies.

leassaf

Instructor
May 20, 2001
49
IL
Basically, what I need is to imitate the action of right-clicking on a folder and choosing “New”, then “Microsoft Word Document”. The I/O namespace seems to allow creating text files only. I cannot create a text file and only change its extension to “*.doc” since the file remains a text file (I need the “Word Document” format). Is there a way to create office files without actually opening them?
 
Interesting question. I would be suprised if there isn't some automation taking place even when you right-click and choose New - Microsoft Word Document from the context menu. However, it may just be making a copy of the blank document template that exists on the system...and in that case your answer would be to do the same, more of a copy file routine than create from scratch. Not having gone and looked yet, I would say that there is a template blank documents are based on and that there is also something in the registry that tells WORD where to find that document to make a copy of it.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Normal.dot

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
That's an elegant way to handle new Word documents. What about Excel or PowerPoint (Or any other COM objects...Visio, Acrobat)? As far as I know, there is no general template exposed to Excel...
 
Well, some of them anyways...you can add more with a little hack, but for the time being here is what I have found out...

New documents are created by Windows copying the files from blank ones held in C:\Windows\ShellNew or C:\WINNT\ShellNew Go to the folder ShellNew and check out what is there. I thought Normal.dot was used for this but I guess it is only used when Word is running and you create a new document from within word. The document that gets created when you use the right-click new feature is the one that exists in ShellNew.



Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Thanks, slighthaze!
If you happen to hear anything new about other files than office, please let me know...
 
ok will do, glad I could help...I'm not sure which of us learned more...I feel like I learned quite a bit here too.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top