Error at compile object has automation variable type MSWord

jemmy
Member Posts: 247
Folks,
Found a little trouble again within Navision Integration. :x
Navision : W1370
OCX : Microsoft Word 11.0 Object Library.
When I compile the object, it will give an error:
The variable MSWORDAPP::MAILMERGEDATASOURCE is defined more than once.
An Example could be: 'File' exists as both a data type and a global variable.
Anyone know how to figure this out? :roll:
Thank in advance as always,
Jemmy
edited:
after I rechecked the C/Al code of the form, I found that:
But, we can't delete one of the line, since this function build in .dll, how to resolve this? :?:
Found a little trouble again within Navision Integration. :x
Navision : W1370
OCX : Microsoft Word 11.0 Object Library.
Variable name : MSWordApp
DataType : Automation
SubType : 'Microsoft Word 11.0 Object Library'.Application
When I compile the object, it will give an error:
The variable MSWORDAPP::MAILMERGEDATASOURCE is defined more than once.
An Example could be: 'File' exists as both a data type and a global variable.
Anyone know how to figure this out? :roll:
Thank in advance as always,
Jemmy
edited:
after I rechecked the C/Al code of the form, I found that:
MSWordApp::MailMergeDataSource(Doc : Automation "'Microsoft Word 11.0 Object Library'.Document") MSWordApp::MailMergeDataSource(Doc : Automation "'Microsoft Word 11.0 Object Library'.Document";VAR Handled : Boolean)
But, we can't delete one of the line, since this function build in .dll, how to resolve this? :?:
0
Comments
-
-
hello,Jemmy
Anda pasti memakai WithEvents. I ever met problem like you but I "rebuild" a new variable type automation(word) again and it work again.0 -
Daniel,
In this case, I used Form 21 Customer Card.
And I put the C/Al code in the menu button Customer to open MS.Word.
But I think this is not caused by Form, is it? :roll:
Angelo,
Rebuild? Do you mean I have to delete and create again?
I have tried but nothing changed.
Anyway thanks.. and hope to hear from you soon.
Jemmy0 -
Try to use a shorter variable name.
Instead of MSWordApp use WdApp or anything else what is short enough, so the events are unique.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Hello Timo, You hit to the point!
I really don't suspect it will be caused by length of variable name.
MSWordApp is 9 chars WdApp is 5 chars. A difference of 4 chars!
I should be aware of these later...
Thanks a lot.
Jemmy0 -
Hello Jimmy,
Itu yang saya maksud. Bikin variable lain, jangan sama persis seperti di buku (file pdf).0 -
When I compile the object, it will give an error:
The variable MSWORDAPP::MAILMERGEDATASOURCE is defined more than once.
An Example could be: 'File' exists as both a data type and a global variable.
Had the same problem in excel, thanks, making the var name shorter..., i never would have guessed it.0 -
yes, it's an old topic, but i found recently this issue in nav 5.0(and 4.03, I don't tested other versions): and it can't be solved with a shorter variable name. why?because there are two other longer triggers:
-mailmergedatasourcevalidate
-mailmergedatasourcevalidate2
and, best of all, using a 1 character-long variable the name is not unique;
the system recognise only 'mailmergedatasourcevalidate' but not the last "2", so the two triggers are the same...for only 1 char.......
](*,) ](*,) ](*,)0 -
Export object in txt and search for definitions of variable. It is common that you have one var defined as global and using same name in local vars.0
-
thanks Malajlo, but i have already checked this: try to create a new codeunit and create only one variable (automation, microsoft word, application)...the error persists...isn't there a way to declare a blank variable??0
-
...ok...try to do this: create a new Codeunit, declare a global variable of type automation, Microsoft Word 12.0 Object Library, Application
compile (error)
cut the entire variable and paste the line in the locals.
compile.........no error!!! :-k0 -
Hi,
Problem is that <varname>::MailMergeDataSourceValidate2 must be 30 or less. Because "::MailMergeDataSourceValidate2" is 30 chars long, NAV is cut the name. If you have a varname with 1 char the event name is cut to W::MailMergeDataSourceValidate. This event already exists.
If you want to use the Automation 'Microsoft Word 12.0 Object Library'.Application as a GLOBAL (without events) you can do it as follows.
1) Define a short global var eg.: WA as an Automation 'Microsoft Word 12.0 Object Library'.Application (With Events = No)
2) Save object without compiling
3) Export object as text
4) Edit text-file and change MailMergeDataSourceValidate2 to MailMergeDataSourceVal2 (or just delete the whole event-line).
OLD:
EVENT WA@1000000045::MailMergeDataSourceValidate2@30(Doc@1000000001 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{00020906-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.Document";VAR Handled@1000000000 : Boolean);
BEGIN
END;
NEW:
EVENT WA@1000000045::MailMergeDataSourceVal2@30(Doc@1000000001 : Automation "{00020905-0000-0000-C000-000000000046} 8.4:{00020906-0000-0000-C000-000000000046}:'Microsoft Word 12.0 Object Library'.Document";VAR Handled@1000000000 : Boolean);
BEGIN
END;
5) Import the text and compile the object. \:D/
This methode works as long as you don't use the events [-X ! If you are using the events the object is compiling but you get a runtime-error.
Who has a solution for using 'Microsoft Word 12.0 Object Library'.Application as a global with events #-o ?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions