View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Edmund Edmund is offline
external usenet poster
 
Posts: 62
Default Same Office 2003 but different VBA ToolsReference (object ref

I did uncheck "MISSING:MS Word 11.0 Office Lib". Infact I went to victim's PC
to select ToolsReference "MS Word 9.0 Office Lib". It worked & code
execution went forward ....but only until it bumps into the below, where I
actually call VBA Word from Excel.

Below is an exerpt of a sub's sub-procedure which calls for Word assistance.
Perhaps it is this which made 11.0 Offlice Lib reference & mandate as macro
haults at "wdCRLF" or "wXYZ" & stuffs with prefix like that.

Private Sub
SaveACopyOfTextFilesIntoLocalDrive_And_Convert_UNI X_text_detect_with_CRLF()
Dim WordApp As Object

Set WordApp = CreateObject("Word.Application")
On Error GoTo ErrorHandler:
With WordApp
' isbp004
.Documents.Open iPath & "\" & iFN_isbp004, ReadOnly:=True,
Format:=wdOpenFormatAuto, Encoding:=1252
.ActiveDocument.SaveAs oPath & "\" & oFN_isbp004,
FileFormat:=wdFormatText, AddToRecentFiles:=True, Encoding:=437,
LineEnding:=wdCRLF
.Documents(oFN_isbp004).Close False

' isbp005
.Documents.Open iPath & "\" & iFN_isbp005, ReadOnly:=True,
Format:=wdOpenFormatAuto, Encoding:=1252
.ActiveDocument.SaveAs oPath & "\" & oFN_isbp005,
FileFormat:=wdFormatText, AddToRecentFiles:=True, Encoding:=437,
LineEnding:=wdCRLF
.Documents(oFN_isbp005).Close False

' 168OPO
.Documents.Open iPath & "\" & iFN_168OPO, ReadOnly:=True,
Format:=wdOpenFormatAuto, Encoding:=1252
.ActiveDocument.SaveAs oPath & "\" & oFN_168OPO,
FileFormat:=wdFormatText, AddToRecentFiles:=True ', Encoding:=437,
LineEnding:=wdCRLF
.Documents(oFN_168OPO).Close False
End With
Set WordApp = Nothing
Exit Sub

ErrorHandler:
Msg = "Please ensure that you are properly connected to the server " &
vbCrLf
Msg = Msg & "before attemting to rerun this application. "
MsgBox Msg, vbCritical, APPNAME & " (UNABLE TO CONTACT SERVER)"
Call ProtocolOnExit
End 'terminate

End Sub

--
Edmund
(Using Excel XP)