473,499 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening blank Word doc using automation

79 New Member
I already know how to open an existing Word document using automation. What I want to do is to open a blank Word document that I can then write to.

What changes should be made to this code?

Expand|Select|Wrap|Line Numbers
  1.     _Document myDoc;
  2.     COleVariant covTrue((short)TRUE);
  3.     COleVariant covFalse((short)FALSE);
  4.     COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
  5.     Documents docs = wordAppLib.GetDocuments();
  6.     CString ReportFileName(_T("filepath goes here"));
  7.     myDoc = docs.Open(COleVariant(ReportFileName),
  8.         covOptional,
  9.         covFalse,  // ReadOnly
  10.         covOptional,
  11.         covOptional,
  12.         covOptional,
  13.         covOptional,
  14.         covOptional,
  15.         covOptional,
  16.         covOptional,
  17.         covOptional,
  18.         covOptional);
Jul 17 '07 #1
0 1111

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3831
by: Jason Steeves | last post by:
I am hoping someone can tell me how, or point me in the right direction for the following problem. I need to have word open a specified file, .mht, as a plug-in inside of IE so that I can edit...
2
1934
by: dixie | last post by:
When I do a mailmerge from Access to Word by automation, sometimes, the Word window does not fully open and can be found up in the very top left hand corner of the screen. Is there a command I can...
4
7639
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to...
4
11114
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
3
6101
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
5
2493
by: Daniel Walzenbach | last post by:
Hi, I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed). The preferable solution would be...
4
2018
by: enak | last post by:
I need to open a Word template so that I can merge some data from a database with the document. I am using ASP.NET, VB.NET. I can not even get MS Word to be visible. I can see that an instance is...
6
2005
by: nikhil | last post by:
Hello every one, Can any one tell me the syntax for opening and closing a file in associated program from C++. For an instance I got a MS word file. How can I open it in MS word from a console...
10
3262
by: cj2 | last post by:
I open a word template in VB and add values to the bookmarks then save the document as as pdf. When I then go to close the document it pops up a save as dialog box. It's already saved the...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7012
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5479
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.