ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Same Office 2003 but different VBA ToolsReference (object ref (https://www.excelbanter.com/excel-programming/395660-re-same-office-2003-but-different-vba-tools-reference-object-ref.html)

Edmund

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)


Halim

Same Office 2003 but different VBA ToolsReference (object ref
 
Do you want to change reference via code?

--
Regards,

Halim



"Edmund" wrote:

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)



All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com