Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2013, 06:47 AM
vodkasoda vodkasoda is offline Word 2007 VBA Program was timing out Windows Vista Word 2007 VBA Program was timing out Office 2007
Novice
Word 2007 VBA Program was timing out
 
Join Date: Apr 2013
Location: Stowmarket, Suffolk, UK
Posts: 15
vodkasoda is on a distinguished road
Default Word 2007 VBA Program was timing out

I have a Word VBA program with the following code ...

Code:
    Set xlApp = CreateObject("Excel.Application")
    Set xlWB = xlApp.Workbooks.Open(xlAppFile)
    
    xlApp.Visible = True
    
    SetTimeouts 180000, 180000
    
    With xlWB.Worksheets(1)
        .Cells(mySessionNo + 1, 2).Activate
        While (myMOTM(0, 0) = "" Or myMOTM(1, 0) = "" Or myMOTM(2, 0) = "")
            myMOTM(0, 0) = .Cells(mySession + 1, 2).Value
            myMOTM(1, 0) = .Cells(mySession + 1, 3).Value
            myMOTM(2, 0) = .Cells(mySession + 1, 4).Value
        Wend
    End With
    
    xlWB.Close True
    xlApp.Quit
    
    Set xlWB = Nothing
    Set xlApp = Nothing
... this is the subroutine, cloned from a Microsoft page ...

Code:
Public Sub SetTimeouts(ByVal lngComponentBusy As Long, ByVal lngRequestPending As Long)

  App.OLEServerBusyTimeout = lngComponentBusy
  App.OLERequestPendingTimeout = lngRequestPending

End Sub
... but I am getting the error message "OBJECT REQUIRED".



I assume this is the "APP.", which has come straight from the MS page I got the code from, but "xlAPP" & "xlWB" give the same result ... what am I doing wrong ?!?
Reply With Quote
  #2  
Old 04-20-2013, 01:29 AM
macropod's Avatar
macropod macropod is offline Word 2007 VBA Program was timing out Windows 7 64bit Word 2007 VBA Program was timing out Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You would need to change .App to .xlApp and have the xlApp object available to all subs in the module.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting image captured with a java program 'on to clipboard' into MSWord 2007 is blur tarunkumarreddy Word 0 02-03-2012 09:42 PM
Word 2007 VBA Program was timing out MS office download timing out suzunow Office 1 12-26-2010 04:41 AM
Office 2007: Adding a program Steve_D Office 0 10-27-2010 03:39 AM
Timing with Custom Animation Hannah PowerPoint 0 03-21-2010 10:57 AM
Slide Timing in Power Point htown PowerPoint 1 09-14-2009 12:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:01 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft