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!

Problem in Visio Automation

Status
Not open for further replies.

bhopaltechie

Programmer
Mar 15, 2003
8
US
While automating Visio in VC++, using the below code, I am facing a problem.
When I instantiate a Visio instance and try to open a document, a window
pops up that asks for a confirmation dialog for opening the file of type
".txt". It asks for the type of text in file and also confirmation for
saving it before closing it.
Is there any way by which I can automate this process. Can I programmatically send the message to press the OK button and automate the whole task.

The code is as under :-

CVisioDocuments docs;
CVisioApplication app;
CVisioDocument doc;
app.put_Visible(FALSE);
app.Documents(docs);
docs.OpenEx("E:\\BOM.txt",visOpenAsHidden,doc);

doc.SaveAsEx("E:\\BOM.vsx",visSaveAsWS);
app.Quit()



 
# import "Vislib.dll"

CoInitialize(NULL);
hr = app.CreateInstance(CLSID_InvisibleApp);
docs.CreateInstance(CLSID_Documents);
docs = app->GetDocuments();
doc.CreateInstance(CLSID_Document);
doc = docs->Add((fileName1.operator LPCTSTR()));
hr = pages.CreateInstance(CLSID_Pages);
pages = doc->GetPages();
page.CreateInstance(CLSID_Page);
page = pages->Add();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top