Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 01-21-2013, 06:33 AM
silverspr silverspr is offline Renaming Word Formfields: string too long error Windows 7 64bit Renaming Word Formfields: string too long error Office 2010 64bit
Novice
Renaming Word Formfields: string too long error
 
Join Date: Apr 2011
Posts: 24
silverspr is on a distinguished road
Default Error 462 remote server does not exist or is not available

HI I wonder if you could help one more time. The script you assisted with earlier, is being called from within Access. I can only run the routine that calls this script once. Then I get the 462 error. My research tells me word is not being closed properly however when opening task manager I can't see any word instances running. Below is the calling script with the line closing word in red:

Function OpenWd()
Dim appWord As Word.Application, strdir As String, strfile As String, strarchive As String
Dim doc As Word.Document
Dim MyDB As Database
Dim rst As Recordset
Dim strDocName As String
Dim blnQuitWord As Boolean

strTemp1 = DLookup("[sFilePath]", "tblconfig", "[description] like ""filepath temp1""")
strdir = DLookup("[sFilePath]", "tblconfig", "[description] like ""filepath strdir""")
strarchive = DLookup("[sFilePath]", "tblconfig", "[description] like ""filepath archive""")

Kill strTemp1
Open strTemp1 For Append As #1

Print #1, """" & "QID" & """" & Chr(59) & """" & "Response" & """" & Chr(59) & """" & "Reviewee" & """"
Close #1
On Error GoTo ErrorHandling

strfile = dir(strdir)

Do While strfile <> ""
strDocName = strdir + strfile

Set appWord = GetObject(, "Word.Application")
Set doc = appWord.Documents.Open(strDocName)
appWord.Visible = False
'With doc
Debug.Print strDocName
Call RenameWdFormFields 'heres where I call the script you helped with
Call GetFld(strTemp1)
'End With

appWord.Documents.Close savechanges:=wdDoNotSaveChanges
strfile = dir()

Loop

If blnQuitWord Then appWord.Quit
'MsgBox "complete"

Cleanup:
'doc.Close
Set rst = Nothing
Set doc = Nothing
Set appWord = Nothing
Exit Function

ErrorHandling:
Select Case Err
Case -2147022986, 429
Set appWord = CreateObject("Word.Application")
blnQuitWord = True
Resume Next
Case 5121, 5174
MsgBox "You must select a valid Word document. " _
& "No data imported.", vbOKOnly, _
"Document Not Found"
Case 5941
MsgBox "The document you selected does not " _
& "contain the required form fields. " _
& "No data imported.", vbOKOnly, _
"Fields Not Found"
Case Else
MsgBox Err & ": " & Err.Description
End Select
GoTo Cleanup
Reply With Quote
 

Tags
"string too long", word formfield



Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming Book Marks in Microsoft Word (2007) cheondee Word 0 03-04-2011 10:36 PM
Rules for when a long word should be split pjl9 Word 1 09-28-2010 07:07 AM
inserting a string of data into an MS Word table??? matto Word VBA 0 07-16-2010 09:35 AM
Word :mac 2008 is crashing all day long... P. Alkuin Word 4 04-20-2010 10:47 PM
How much long auhtentic is a word document? plaszma Word 0 11-08-2009 09:28 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:37 PM.


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