Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Components
|
VB Components Issues specific to components in VB.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 3rd, 2009, 01:14 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jnd03022009
Default application.word object variable not set

I had this problem today and went searching for an answer in P2P and couldn't find any similar threads. I have found a solution, but thought I'd document it here for others who might need it.

Here is a code fragment:
Code:
Dim  appWord As Word.Application, wrdDoc As Word.Document

        On Error Resume Next
        'Use word to open the output file 
        Set appWord = CreateObject("Word.Application")
        On Error GoTo appWordError
        
        Set wrdDoc = appWord.Documents.Open(g.strPAMPath & "F" & j.RunJobID & ".p1")
It was failing with Object variable or with block not set on the "set wrdDoc =" line.

The cause of the problem turns out to be that this computer had a more recent version of MS Office (2007) installed, then we reverted back to an older version (2003).

To resolve:
Open Add or Remove Programs
Find the Microsoft Office 2007 Primary Interop Assemblies
Click the remove button
 
Old February 3rd, 2009, 01:15 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jnd03022009
Default This Thread is already resolved

I hope it is useful for others





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object variable or With block variable not set I_Chappers ASP.NET 2.0 Basics 3 June 26th, 2008 04:15 PM
Object variable or With block variable not set haidee_mccaffrey Classic ASP Professional 5 March 8th, 2007 03:34 PM
object variable or with block variable not set Aoude BOOK: Beginning VB.NET Databases 1 February 24th, 2006 05:21 PM
Object Variable or With Block Variable not Set Parbish BOOK: Beginning VB.NET Databases 5 July 13th, 2005 04:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.