Solved

VBA in Word

Posted on 2012-03-16
2
327 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 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now