Solved

VBA in Word

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Outlook Free & Paid Tools
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
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.

680 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