Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA in Word

Posted on 2012-03-16
2
Medium Priority
?
339 Views
Last Modified: 2012-03-20
Hi Guys

I am trying to create a Word Macro.

I am using Maximizer CRM API.

I added a reference to the Maximizer Type Library.

Dim Company as string
Dim objMaxAttach As New MaximizerTLB.AttachToCurrentInstance    
        Dim objMaxCur As MaximizerTLB.CurrentRecord
        Dim objMaxApp As MaximizerTLB.Application
        objMaxCur = objMaxAttach.GetCurrentRecordObject      
        objMaxApp = objMaxAttach.GetApplicationObject

Company = objMaxCur.GetFieldValue("Company")

 objMaxApp = Nothing
        objMaxCur = Nothing    
        objMaxAttach = Nothing

It fails on  'objMaxCur = objMaxAttach.GetCurrentRecordObject ' with error object variable not set'.

If I step through code all Declarations are set to nothing. i.e objMaxAttach = 'Nothing'

This code works in visual studio 2008.

Thanks,
Shezad
0
Comment
Question by:Shezad Ahmed
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 37730253
You need to use Set for objects in VBA

Set objMaxCur = objMaxAttach.GetCurrentRecordObject      
Set objMaxApp = objMaxAttach.GetApplicationObject
0
 

Author Closing Comment

by:Shezad Ahmed
ID: 37741414
Thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question