troubleshooting Question

Run-time error '462' word from access on second run through

Avatar of sydneyguy
sydneyguyFlag for Australia asked on
Microsoft AccessMicrosoft Word
3 Comments1 Solution617 ViewsLast Modified:
works fine the first time but on the second time through it throws up a
erroro 462 server not available.
Have been through a fair few sites but still have not come up with a workable solution, may be another set of eyes.
thanks for your help

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click


     Dim oRange
   Dim wdApp As Word.Application
 
   Dim doc As Object
   Dim CellSize As Integer
 
   Set wdApp = New Word.Application
 
   Set doc = wdApp.Documents.Add
   wdApp.Visible = True

   ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=10, NumColumns _
              :=1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
              wdAutoFitFixed
   
    Set wdApp = Nothing

Exit_Command0_Click:
    Exit Sub

Err_Command0_Click:
    MsgBox Err.Description
    Resume Exit_Command0_Click
   
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros