Hi all,
I apologize in advance about the information I can't provide here--believe me, it's out of my control.
SETUP:
I'm using AutoOpen to scan documents opened by a proprietary, web-based document-tracking system. The system opens up the document from IE (I assume via some sort of ActiveX magic); the document opens in Word, not in Internet Explorer.
PROBLEM:
Part of their package is a Word macro (password protected, of course) that allows for the uploading of documents back to their server. Occasionally, under what seems to be absolutely arbitrary times with no identifiable causes, this upload macro causes a "4160 BAD FILE NAME" error and fails to upload the document to their server. If you reopen the document from their web-based program, it usually works. (This may happen 1 out of 100 attempts). Due to an inasnely annoying bureaucracy, I cannot A) get access to their VBA code to see where the problem is or B) get them to do anything about it. This has been going on for months.
For at time before this error started (I think), I had been using a few macros but not calling them via AutoOpen. It may be a coincidence, but I think it's not, but these errors seemed to have started once I started using AutoOpen.
QUESTIONS
1. Is there any way that AutoOpen would interfere with the correct loading of a document from this sort of process?
2. Any suggestions?
3. And if not, anyone know any good shrinks? Cuz this is driving me crazy...
I'm including the VBA code below, but I'm more concerned with the AutoOpen command itself.
Thank you kindly,
David
Sub AutoOpen()
Dim ResponseQuestion As String
'I added DoEvents here in the vain hope that it would somehow ease the problem--no effect.
DoEvents
Application.Visible = True
Application.WindowState = wdWindowStateMaximize
ActiveDocument.ActiveWindow.WindowState = wdWindowStateMaximize
If (ActiveDocument.ReadOnly = True Or ActiveDocument.ProtectionType <> wdNoProtection) Then
StatusBar = "Macro not operational because document is read only."
Exit Sub
End If
'SearchFunction is just a quick ActiveDocument.Find replacement
Selection.HomeKey Unit:=wdStory
If SearchFunction("CENTER RECEIPT NOTIFICATION LETTER", True, False) Then
'I messed with the SaveInterval to see if not AutoSaving would help things... no luck
Options.SaveInterval = 0
LetterEdit '
Else
Options.SaveInterval = 5
Selection.HomeKey Unit:=wdStory
If SearchFunction("Confirmation of Withdrawal", True, False) Then
Selection.HomeKey Unit:=wdStory
If SearchFunction("Something in the letter.", True, False) Then Withdrawal
End If
Selection.HomeKey Unit:=wdStory
If SearchFunction("NOTICE OF CASE CLOSURE", True, False) Then
Selection.HomeKey Unit:=wdStory
If SearchFunction("Something in the letter.", True, False) Then CaseClosure
End If
End If
EndGame:
CommandBars("NOF").Visible = True
End Sub
/Edit/ Word 2003 /Edit/