- Код: Выделить всё
Sub CB_Valuta()
Dim i As Object
Dim FirstLine As Object
Dim str15 As String
Dim str13 As String
Dim str12 As String
Dim str11 As String
Dim tmpName7 As Object
Dim ExcelWasNotRunning As Object
Dim MyXL As Object
If ExcelWasNotRunning = True Then
MyXL.Application.Quit()
End If
Finish = CStr(2)
Const strName As String = "ЦБ - Курсы валют"
tmpName7 = "c:\Priem\tabl.xls"
' ======== Declarations =====
Dim xl As Excel.Application
Dim xlBook As Excel.Workbook
xl = New Excel.Application
xl.DisplayAlerts = False
xlBook = xl.Workbooks.OpenXML(tmpName7, , 2)
ExcelGlobal_definst.Selection.Replace(What:="Английский фунт стерлингов", Replacement:="Англ. фунт стерлингов", LookAt:=Excel.XlLookAt.xlPart, SearchOrder:=Excel.XlSearchOrder.xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False)
' Тэги для ИнДеза
str11 = "<pstyle:><ptr:31\,Left\,.\,0\,\;141.73\,Right\,.\,0\,\;><ct:BT Cyrillic><cs:7.5><chs:0.9><cl:9><cf:BellGothicC BT>"
str12 = "<pstyle:><ptr:31\,Left\,.\,0\,\;141.73\,Right\,.\,0\,\;><pRuleBelowStroke:0.3><pRuleBelowOffset:2.834646><pRuleBelowOn:1><ct:BT Cyrillic><cs:7.5><chs:0.9><cl:9><cf:BellGothicC BT>"
str13 = "<ct:><cs:><chs:><cl:><cf:><ct:Blk DP Cyrillic><cs:7.5><chs:0.9><cl:9><cf:BellGothicC Blk DP>"
str15 = "<ct:><cs:><chs:><cl:><cf:><ct:BT Cyrillic><cs:7.5><chs:0.9><cl:9><cf:BellGothicC BT>"
FileOpen(1, "C:\Priem\ЦБ - Курсы валют.txt", OpenMode.Output)
PrintLine(1, "<CYRILLIC-WIN>")
Dim r As Excel.Range
r = xl.Cells.Find("Австралийский доллар", ExcelGlobal_definst.ActiveCell, Excel.XlFindLookIn.xlFormulas, Excel.XlLookAt.xlPart, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False, False)
FirstLine = r.Row
For i = FirstLine To FirstLine + 15
If i Mod 10 = 0 Then System.Windows.Forms.Application.DoEvents()
If i Mod 5 = 0 Then
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 17). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str15. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 16). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str13. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 15). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str12. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
PrintLine(1, str12 & ExcelGlobal_definst.Cells._Default(i, 15) & str13 & Chr(9) & ExcelGlobal_definst.Cells._Default(i, 16) & str15 & Chr(9) & ExcelGlobal_definst.Cells._Default(i, 17))
Else
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 17). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str15. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 16). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str13. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 15). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str11. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
PrintLine(1, str11 & ExcelGlobal_definst.Cells._Default(i, 15) & str13 & Chr(9) & ExcelGlobal_definst.Cells._Default(i, 16) & str15 & Chr(9) & ExcelGlobal_definst.Cells._Default(i, 17))
End If
Next
'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
i = 49
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 17). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str15. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 16). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str13. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object Cells(i, 15). Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
'UPGRADE_WARNING: Couldn't resolve default property of object str11. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
Print(1, str11 & ExcelGlobal_definst.Cells._Default(i, 15) & str13 & Chr(9) & ExcelGlobal_definst.Cells._Default(i, 16) & str15 & Chr(9) & ExcelGlobal_definst.Cells._Default(i, 17))
FileClose(1)
выкидвает ошибку, мол неправильный переход объекта в стринг
что делать?