Click here to Skip to main content
16,008,942 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: count() function using STL Pin
toxcct26-May-04 22:56
toxcct26-May-04 22:56 
GeneralRe: count() function using STL Pin
BlackDice27-May-04 3:03
BlackDice27-May-04 3:03 
GeneralDirectShow and C++ (No-MFC) Pin
Paolo Ponzano26-May-04 10:33
Paolo Ponzano26-May-04 10:33 
GeneralRe: DirectShow and C++ (No-MFC) Pin
Antti Keskinen26-May-04 11:32
Antti Keskinen26-May-04 11:32 
GeneralRe: DirectShow and C++ (No-MFC) Pin
Paolo Ponzano26-May-04 19:23
Paolo Ponzano26-May-04 19:23 
GeneralTreeCtrl in DialogBar in MFC MDI Pin
NTense26-May-04 9:58
NTense26-May-04 9:58 
GeneralRe: TreeCtrl in DialogBar in MFC MDI Pin
valikac26-May-04 13:20
valikac26-May-04 13:20 
GeneralWord Automation help Pin
C++NewBe26-May-04 9:54
C++NewBe26-May-04 9:54 
Can someone guide me on how to add text to a word document using "Bookmarks" from a word template "file.dot". I started with the visual C++ code below but I get lost trying to follow the Microsoft Word Objects schema, I just don't know how to tie it in like the VB example.


Visual Basic example code ___________________________________________________
Set wrdApp = CreateObject("Word.Application")
wrdApp.Documents.Open("c:\file.dot")
wrApp.ActiveDocumnet.Bookmarks("String One").Range.Text = "Vb sample"
________end of VB example____________________________________________________



Visual C++ __________________
void SystemAlign::CreateDoc(void)
{
CApplication oApp;
CBookmarks oBooks;
Cbookmark oBook;
CDocuments oDocs;
Cdocument oDoc;
CRange oRange;

COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR),
vtTrue((short)TRUE),
vtFalse((short)FALSE);

// Create an instance of Word
if (!oApp.CreateDispatch("Word.Application"))
{
AfxMessageBox("Word failed to start!");
return;
}

oDocs = oApp.get_Documents();
oDoc = oDocs.Open("c:\My Documents\file.dot", vtOptional);
oBooks = oApp.get_ActiveDocument();

//oApp.get_ActiveDocument()
}
GeneralGet around having to use constants for 2d dynamic memory allocation Pin
aero6dyn26-May-04 9:45
aero6dyn26-May-04 9:45 
GeneralRe: Get around having to use constants for 2d dynamic memory allocation Pin
Rob Manderson26-May-04 10:39
protectorRob Manderson26-May-04 10:39 
GeneralRe: Get around having to use constants for 2d dynamic memory allocation Pin
aero6dyn27-May-04 8:00
aero6dyn27-May-04 8:00 
GeneralBitmap trace Pin
Vaclav26-May-04 9:25
Vaclav26-May-04 9:25 
GeneralDesparate Help needed Pin
dhermann26-May-04 8:52
dhermann26-May-04 8:52 
GeneralRe: Desparate Help needed Pin
GermanGeorge28-May-04 4:14
GermanGeorge28-May-04 4:14 
Generalpointer arithemetic (on an STL iterator) Pin
BlackDice26-May-04 7:29
BlackDice26-May-04 7:29 
GeneralRe: pointer arithemetic (on an STL iterator) Pin
BlackDice26-May-04 7:40
BlackDice26-May-04 7:40 
Generalgot it! Pin
BlackDice26-May-04 8:12
BlackDice26-May-04 8:12 
GeneralRe: pointer arithemetic (on an STL iterator) Pin
David Crow26-May-04 8:16
David Crow26-May-04 8:16 
GeneralVARIANT Pin
Roger H Art26-May-04 6:59
sussRoger H Art26-May-04 6:59 
GeneralRe: VARIANT Pin
mezla26-May-04 21:42
mezla26-May-04 21:42 
GeneralVARIANT Pin
Anonymous26-May-04 6:58
Anonymous26-May-04 6:58 
GeneralWindows media player Pin
Trollslayer26-May-04 6:56
mentorTrollslayer26-May-04 6:56 
GeneralRe: Windows media player Pin
Michael Dunn26-May-04 8:32
sitebuilderMichael Dunn26-May-04 8:32 
GeneralRe: Windows media player Pin
Trollslayer26-May-04 9:45
mentorTrollslayer26-May-04 9:45 
GeneralDate/Time Picker in CListCtrl Pin
aswdwdwd26-May-04 6:40
aswdwdwd26-May-04 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.