Return automation type from function

Debbie140
Member Posts: 52
I have a function in a code unit that creates a word document. I want to return the word document object back to the calling function. Is this possible. I am using WordApp.ActiveDocument in the calling function at the moment to access the open word document but this does not always work. Is there a better way to get a handle on it.
Thanks
Debbie
Thanks
Debbie
0
Comments
-
Create another automation variable of the Word, class Document:
varDoc := WordApp.ActiveDocument;
You can then access the methods and properties of the varDoc.0 -
1. Add an automation variable to your globals in the calling object.
2. You don't have to use the CREATE code in the calling object.
3. Create a function in the codeunit
4. Give this function an parameter of the type Word.Document (didn't check, but should be something like this).
5. Check the "VAR" option with this parameter.
6. Use the parameter variable to create the document (and not the variable you already have in your CU, replace it.
When you parse the variable made in step 1 to the function you will receive the created document in the calling object.
(for examples of parsing automation variables to codeunits download the embedded controls demo and see how charts are filled by using standard codeunits, same principle)In a world without Borders or Fences, who needs Windows and Gates?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