|
I have office 2000 installed on my computer, when i tried to compile the project i had error at the line:
_CommandBarsPtr CommandBars;
can anyone help me with this
thanx
|
|
|
|
|
I have encountered a similar problem in the tli/tlh files with Office 2000.
What happened in my case is that when '#importing' the vbeext1.olb file, it xrefs to the mso97.dll (from Office 97), rather than the mso9.dll (from office 2000).
I suspect this is because I installed Access 97 after installing Office 2000.
Resolution :
1. I just renamed mso9.dll to be mso97.dll -- in my case I can get away with this.
2. Better idea is to reinstall Office 2000, perhaps.
|
|
|
|
|
I have encountered a similar problem in the tli/tlh files with Office 2000.
What happened in my case is that when '#importing' the vbeext1.olb file, it xrefs to the mso97.dll (from Office 97), rather than the mso9.dll (from office 2000).
I suspect this is because I installed Access 97 after installing Office 2000.
Confirmation :
Look at the line 'Cross Referenced Type Files' in the generated .tlh files to confirm this guess.
Resolution :
1. I just renamed mso9.dll to be mso97.dll -- in my case I can get away with this.
2. Better idea is to reinstall Office 2000, perhaps.
|
|
|
|
|
Delete all file of extention name that is *.tlh, *.tli in directory and subdirectory
and Recompile!!!
Errors disappear.
|
|
|
|
|
The previous message is correct. Copy MSO9.DLL from the office directory (usually C:\Program Files\Microsoft Office\Office) and rename it MSO97.DLL.
Deleting the type library (*.tlh and *tli) is not a bad idea, too. A 'rebuild all' would also be a good idea.
Many project, many years, many tears...
|
|
|
|
|
The previous message is correct. Copy MSO9.DLL from the office directory (usually C:\Program Files\Microsoft Office\Office) and rename it MSO97.DLL.
Deleting the type library (*.tlh and *tli) is not a bad idea, too. A 'rebuild all' would also be a good idea.
Many projects, many years, many tears...
|
|
|
|
|
_CommandBarsPtr Defined in mso.tlh(mso9.tlh),
but it is include in "Office" namespace,
before you import,use like this:
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL"
using namespace Office;
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files\Microsoft Office\OFFICE11\MSWORD.OLB" \
rename("ExitWindows","_ExitWindows")
|
|
|
|
|
hi,
I found the article it was very helpful.
I'm developing a tailored program, based on word2000.
It's an SDI program with an embedded document.
It's no problem to operate all of the commands (including My own macros)
beside of the File menu.
at first it didn't appear, so I edited a word template with a custom menu called "File" and just put all of the operations I need there (save, save as, versions, new, open).
in runtime they all appear grayed.
when I try running a VBA Macro that calls save, I get an ambigious message.
can anyone help me out there?
Thank you,
Omri
|
|
|
|
|
Is it possible to integrate AutoCAD into my App this way?
Where can I get relevant information?
Thanks.
Lirong;)
|
|
|
|
|
If AytoCAD supports ActiveX Document technology it's possible.
|
|
|
|
|
Hi,
You did a good job.
I would like to automate Word97 and Word2000 in VC++6.0.
Because i have word2000 installed on my computer, I try to copy the files MSO97.DLL, VBEEXT1.OLB and MSWORD8.OLB to a directory of my project, and i add #import for these files in stdafx.h.
But when compiling, i have error messages (_CommandBarPtr is unknown).
My code looks like that :
#pragma warning (disable:4146)
#pragma warning (disable:4786)
#import "INTERFACE\PRINT\REFERENCE\MSO97.DLL" no_namespace
#import "INTERFACE\PRINT\REFERENCE\VBEEXT1.OLB" no_namespace
#import "INTERFACE\PRINT\REFERENCE\MSWORD8.OLB" rename("ExitWindows", "ExitWindowsWD")
#pragma warning (default:4786)
#pragma warning (default:4146)
Have you any idea about this ??
Thank you
Jean-Yves
|
|
|
|
|
I guess then compiler reads type library and this type library has link to other type library compiler tries to find last one using registry. So, compiler will use MS Office 2000 type libraries
I had these problems and currently I use MS Office 2000, but I do not use new its features and my programms work correctly with both 97 and 2000 versions.
Happy coding,
Igor
|
|
|
|
|
I'm having problem with loading my original menu after closing an embeden Exceldocument. I have tried to load all the menus again but it doesn't seem to work.
Is there anyone with a solution to this problem?
/David
|
|
|
|
|
I cant put the excel chart anywhere except for the first page. Does anyone know who to switch from page to page. Any help will be appreciated. Thanx in advance.
DrunkerII
|
|
|
|
|
Hi,
First of all, I would like to say that You made a really great Job!!!
I'm trying to make the program automated. For that, I would like to import all changes
of the Word or Excel documents in the dialogue window, so that it could go back and forth depending
on if you want to write (or save something) in the Word/Excel Docs or display the changes you
made in that ones.
Could somebody help me???
Cheers,
Thierry
|
|
|
|
|
I created a Marco in MSWORD including such code:
Application.PrintOut Background:=True, Append:=False, Range:=wdPrintFromTo, OutputFileName:="c:\tmp\word.prn", From:="1", To:="3", _
Item:=wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, PrintToFile:=True, _
Collate:=True, FileName:="", ActivePrinterMacGX:="", ManualDuplexPrint:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
It's all right.
I created a simple VB project, there's a button associated with such code:
Dim wrd As Object
Dim doc As Object
Set wrd = CreateObject("Word.Application")
Set doc = wrd.documents.open("c:\tmp\word.doc")
wrd.PrintOut True, False, 3, "c:\tmp\word.prn", "1", "3", 0, 1, "", 0, True, True, "", False, 0, 0, 0, 0
Set wrd = Nothing
A "Mismatch type" run-time error was occured(VC++ project too). Why?
|
|
|
|
|
If your code starts a Office application instance itself, you should invoke the Quit method of the Application object manually.
Dandy Cheung
|
|
|
|
|
Thank you for comment.
Unfortunately, I don't know how my application starts the Office because it uses OleCreateFromFile function. I know about this problem and then I wrote this article I tried to call Quit method, but it does not work. It seems to me that the problem is bound up with ActiveX Document Mode. In standard mode it works correctly.
Regards,
Igor.
|
|
|
|
|
Thanks alot for a great artical, one question how can use the menu from MSWORD inside my app, MSWORD starts and the save and save as and open menus are grayed out, how can I activate them so I can use them.
Thanks
|
|
|
|
|
Hi,
thx for your great application and information to my last thread, I have office 2000 installed, if I now open an active word 2000 document, then there are popping up some control panels of word 2000, is there any way to avoid these ?? Sorry, I'm not so familiar with active container programming....
2. I have no chance to save any changed text in an opened word document or excel sheet..., why will the changes not be saved, hmm, don't know really why.., saw that the save modified was included....
3. Question about print preview, I also really didn't understand why print preview isn't really working, maybe there will be some experts who can answer this question, maybe it would be worth to ask that question on experts-exchange.com
Thx for your help,
Michael Kuelshammer
|
|
|
|
|
1. It was discussed in first thread. You can disable CommandBar in the following way
doc->Application->CommandBars->Item[L"BarName"]->Visible = false;
2. See step 8. I excluded saving of data being changed. Delete it and try again.
3. I think we can't use preview, because it needs the Microsoft Word application framework so it's impossible in ActiveX mode.
Regards,
Igor
|
|
|
|
|
If I want to integrate your nice source code to my program and want to send it to different clients in foreign countries, then I do not now, which office version the client has installed on his machine, so one solution is, to make different program versions (compiled with different office.h-versions for office 97 or office 2000) that will be installed, so that the installation program has to take care about, which program version will be installed, or is there any other possibility, so that the client can choose the office version he uses by selecting office version in the program itself. I think also that there is a problem, that on german machines there are paths like C:\Programme\Gemeinsame Dateien\...
and on english operating systems they are C:\Program files\Common files\...
Is there any solution for the above problem ??
Thx,
Michael Kuelshammer
|
|
|
|
|
Yes, of course. There are some differences between the various versions of the MS Office. But if you would follow the next rules you would not have big problems.
1. If you are using the MS Office 97 your application will be fully compatible with the MS Office 2000 version.
2. If you are using the MS Office 2000 you should check names of methods, which are being used in your application. For example, method “Run” was changed in the MS Word 2000. This is a new method and now it has a lot of parameters and other dispatch ID. The MS World 97 does not have method with the same ID and as a result the MS World 97 will generate exception. Old method is still exists but it has “RunOld” name. If you use this name you will keep compatible. Nevertheless you can use new version of the methods, you can always check the MS Office version programmatically.
Path to the MS Office directory is necessary only during compile-time and you do not need to take care about it during the run-time because paths in the XOffice.h have nothing to do with a method, which COM uses to locate and load the ActiveX objects.
Best regards,
Igor.
|
|
|
|
|
You are importing MSO9.DLL, which exposes interfaces such as Office's CommandBar's, etc.
Is there any way to use these?
Thanks for any help, and for the great article
|
|
|
|
|
Step 9 shows how we can get IDispatch interface of ActiveX document and it is available after execution of CXOfficeView::OnInitialUpdate(). For example, we can add next code on at the end of this procedure:
try {
Word::_DocumentPtr doc = m_pSelection->m_disp;
if (doc != 0) {
doc->Application->CommandBars->Item[L"Web"]->Visible = true;
}
} catch (_com_error& er) {
ComMessage(er);
}
|
|
|
|
|