Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > C++

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-19-2009, 03:33 AM
shilpi_gupta070 shilpi_gupta070 is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
Word Application using C++

Hello Friends,

I am facing one problem While writing code for opening one word document using C++ Code,I am getting exception at the highlighted code.If I use any other word API then also I am getting exception.Is their anything else which I have to initialize to getting it work smoothly or I am missing something .

Can anyone Help me on this?

::CoInitialize(NULL);
using namespace Word;
_ApplicationPtr word=NULL;
_DocumentPtr vk_my_doc = NULL;
_DocumentPtr vk_new_doc = NULL;
// create application object
word=_ApplicationPtr(__uuidof(Application));
word->Visible = true;
word->raw_Activate();
VARIANT v1 ;
v1.vt = VT_BSTR;
v1.bstrVal = ::SysAllocString(L"C:\\test.doc");
word->Documents->Open(&v1); //vk_new_doc = word->Documents->Add();
::CoUninitialize();
Regards
Shilpi Gupta
Reply With Quote
  #2  
Old 10-19-2009, 03:55 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
http://support.microsoft.com/kb/196776

http://support.microsoft.com/kb/238972
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
  #3  
Old 10-20-2009, 09:39 AM
shilpi_gupta070 shilpi_gupta070 is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
Problem Solved

Hi,

Thanks,
The problem is solved . In office 2007 the extension of the file should be docx not only doc.Now It is working fine and opening the document.

Regards
Shilpi Gupta

Thanks for the links
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database driven application on Cell Phones Adam Mobile 2 09-26-2005 12:35 PM
rmi problem passing object from server class to application jbste Java 0 06-15-2005 08:31 PM
Inventory Management Application Using VB Krishna vb.announcements 0 11-26-2002 12:03 AM
Search for MS Word (Parents and child window) Sasha Polinskaya VB Classic 21 02-15-2002 08:05 PM


All times are GMT -4. The time now is 10:33 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.