Solved

VBA in Word

Posted on 2012-03-16
2
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

632 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