Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using VBA in Excel to create a Word document containing tables
from a spreadsheet. However, I often get an error message that pops up: "The object is not responding because the source application may be busy." When I stop the program at that point, I get the VBA error: "Automation error - Call was rejected by callee." Here is how I start Word: Function StartWord() As Boolean StartWord = False ' Try to open an existing instance of Word On Error Resume Next Set WordApp = GetObject(, "Word.Application") On Error GoTo 0 ' If Word is not started, start a new instance If WordApp Is Nothing Then Set WordApp = CreateObject("Word.Application") End If WordApp.Visible = False StartWord = True End Function Here are the relevant code snippets that use Word: ' Start the Word application If Not StartWord() Then MsgBox "Unable to start Microsoft Word", vbCritical, "Microsoft Word Error" Exit Function End If ' Add a new Word document WordApp.Application.ScreenUpdating = False WordApp.Documents.Add 'Set DataTableWS = DataWB.Sheets("table") ' Set up Word document properties With WordApp.ActiveDocument.PageSetup .Orientation = wdOrientPortrait .TopMargin = 20 .BottomMargin = 20 .LeftMargin = 40 .RightMargin = 40 .PageWidth = 700 .PageHeight = 800 .Gutter = 0 End With It consistently bombs on the statement: With WordApp.ActiveDocument.PageSetup Can anyone provide advice on this problem? Thanks, Alan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel object linked to word will not add sums in word | Excel Discussion (Misc queries) | |||
Excel Object in Word Document | Excel Programming | |||
windows excel &word 2003 pro save as command not responding | Excel Discussion (Misc queries) | |||
can't save anything in excel or word .... i get "not responding" | Excel Discussion (Misc queries) | |||
word object in excel | Excel Programming |