powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / VB error in PT_EndRpt - Method '~' of object '~' failed
2 сообщений из 2, страница 1 из 1
VB error in PT_EndRpt - Method '~' of object '~' failed
    #36000644
Macros123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
В VB я новичок. Поэтому нужна ваша помощь.
У меня проблемма с репортами, а точнее с макросом в xls фаиле.
Мы для репортов используем yardi (это редкий софт, мало кто о нем знает), на старий версии все работает хорошо, а на новой показывает ошибку: VB error in PT_EndRpt - Method '~' of object '~' failed.

Поделитись идеями, в чем тут дело и что может не так...


Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
315.
316.
317.
318.
319.
320.
321.
322.
323.
324.
325.
326.
327.
328.
329.
330.
331.
332.
333.
334.
335.
336.
337.
338.
339.
340.
341.
342.
343.
344.
345.
346.
347.
348.
349.
350.
351.
352.
353.
354.
355.
356.
357.
358.
359.
360.
361.
362.
363.
364.
365.
366.
367.
368.
369.
370.
371.
372.
373.
374.
375.
376.
377.
378.
379.
380.
381.
382.
383.
384.
385.
386.
387.
388.
389.
390.
391.
392.
393.
394.
395.
396.
397.
398.
399.
400.
401.
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415.
416.
417.
418.
419.
420.
421.
422.
423.
424.
425.
426.
427.
428.
429.
430.
431.
432.
433.
434.
435.
436.
437.
438.
439.
440.
441.
442.
443.
444.
445.
446.
447.
448.
449.
450.
451.
452.
453.
454.
455.
456.
457.
458.
459.
460.
461.
462.
463.
464.
465.
466.
467.
468.
469.
470.
471.
472.
473.
474.
475.
476.
477.
478.
479.
480.
481.
482.
483.
484.
485.
486.
487.
488.
489.
490.
491.
492.
493.
494.
495.
496.
497.
498.
499.
500.
501.
502.
503.
504.
505.
506.
507.
508.
509.
510.
511.
512.
513.
514.
515.
516.
517.
518.
519.
520.
521.
522.
523.
524.
525.
526.
527.
528.
529.
530.
531.
532.
533.
534.
535.
536.
537.
538.
539.
540.
541.
542.
543.
544.
545.
546.
547.
548.
549.
550.
551.
552.
553.
554.
555.
556.
557.
558.
559.
560.
561.
562.
563.
564.
565.
566.
567.
568.
569.
570.
571.
572.
573.
574.
575.
576.
577.
578.
579.
580.
581.
582.
583.
584.
585.
586.
587.
588.
589.
590.
591.
592.
593.
594.
595.
596.
597.
598.
599.
600.
601.
602.
603.
604.
605.
606.
607.
608.
609.
610.
611.
612.
613.
614.
615.
616.
617.
618.
619.
620.
621.
622.
623.
624.
625.
626.
627.
628.
629.
630.
631.
632.
633.
634.
635.
636.
637.
638.
639.
640.
641.
642.
643.
644.
645.
646.
647.
648.
649.
Option Explicit

Dim sOutFile$, sTitle1$, sTitle2$, sTitle3$, sTitle4$, sAddr1$, sCsz$
Dim bOutFile As Boolean
Dim bPrint As Boolean

Sub Auto_Open()

  Call CheckFlag
  
  If bOutFile Then
    Application.Visible = False
    Application.ScreenUpdating = False
  End If
  
  Application.DisplayAlerts = False
  
  Call Coll_Summary
  Call TitleFormat
  Call SheetFormat
  Call Add_Logo
  

  If bOutFile Then
    Call OutFile
  End If
  
  Windows("ro_Collection_Status_Summary.xls").Activate
  If bOutFile Then
    ActiveWorkbook.Close ( 0 )
  ElseIf bPrint Then
    Application.Visible = True
    Application.ScreenUpdating = True
    Windows("ro_Collection_Status_Summary.xls").WindowState = xlMaximized
    ActiveWindow.SelectedSheets.PrintOut Copies:= 1 , Collate:=True
    Application.Quit

  Else
    Application.ScreenUpdating = True
    Windows("ro_Collection_Status_Summary.XLS").WindowState = xlMaximized
    Cells( 1 ,  1 ).Select
  End If
  

End Sub

Sub Coll_Summary()
  
  Dim iRows%, iRowX%, iRowY%
  Dim i%, j%, ij%, iLength%, ii%, iStatus%
  Dim sNote$
  Dim dShares As Double
  Dim sChargeDesc$, sChargeGroup$, sTotal$
  Dim dGrossReceipts As Double
  Dim dNSFReceipts As Double
  Dim dTotalReceipts As Double


  Windows("ro_Collection_Status_Summary.XLS").WindowState = xlMinimized
  Windows("ro_Collection_Status_Summary.CSV").WindowState = xlMinimized
  Application.ScreenUpdating = False

  Workbooks("ro_Collection_Status_Summary.xls").Worksheets("Sheet1").Activate
  Cells.Select
  Selection.Delete
  
  'delete all objects
  Range("A1:AT" &  55 ).Delete
  
  Workbooks("ro_Collection_Status_Summary.csv").Activate
  sOutFile = Workbooks("ro_Collection_Status_Summary.csv").Worksheets( 1 ).Cells( 1 ,  1 )
  iRows = ActiveCell.SpecialCells(xlLastCell).Row

'copy & paste csv into xls
  Workbooks("ro_Collection_Status_Summary.csv").Activate
  Range("A1:L" & iRows).Select
  Range("A1:L" & iRows).Copy
  Workbooks("ro_Collection_Status_Summary.xls").Activate
  Range("A1:L" & iRows).Select
  ActiveSheet.Paste

'Close csv
  Windows("ro_Collection_Status_Summary.csv").Activate
  ActiveWorkbook.Close ( 0 )

'get address and CityStateZip
  For i =  1  To  6 
    If Left(Cells(i,  1 ),  4 ) = "ADD1" Then
      iLength = InStr(Cells(i,  1 ), "CSZ=")
      sAddr1 = Mid(Cells(i,  1 ),  7 , iLength -  7 )
      sCsz = Mid(Cells(i,  1 ), iLength +  5 )
      Rows(CStr(i) + ":" + CStr(i)).Select
        Selection.Delete Shift:=xlUp
      Exit For
    End If
  Next i
  
    'Store 3 titles and delete section
  sTitle2 = Cells( 2 ,  1 ).Value
  sTitle1 = Cells( 3 ,  1 ).Value
  sTitle3 = Cells( 4 ,  1 ).Value
  sTitle4 = Cells( 5 ,  1 ).Value
  
  Rows("1:5").Select        'delete title rows
    Selection.Delete Shift:=xlUp
    
  Rows("4:5").Select        'insert blank lines after headings
    Selection.Insert Shift:=xlDown


'If Mid(Cells(4, 1), 1, 11) = "Grand Total" Then
'  ii = 2
'Else
'  ii = 8
'End If

'set columns
  Columns("A:A").ColumnWidth =  10 
  Columns("B:B").ColumnWidth =  22 #
  Columns("C:C").ColumnWidth =  10 . 14 
  Columns("D:E").ColumnWidth =  8 . 25 
  Columns("F:F").ColumnWidth =  1 . 8 
  Columns("G:G").ColumnWidth =  8 . 25 
  Columns("H:H").ColumnWidth =  1 . 8 
  Columns("I:I").ColumnWidth =  8 . 25 
  Columns("J:J").ColumnWidth =  1 . 8 
  Columns("K:L").ColumnWidth =  8 . 25 
  Columns("M:M").ColumnWidth =  20 
 
  Columns("B:B").InsertIndent  2    'INDENT CHARGE NAMES
  Columns("D:L").NumberFormat = "#,##0.00_);(#,##0.00)"

ii =  5 
While Mid(Cells(ii,  1 ),  1 ,  11 ) <> "Grand Total"

  'right justify the building#
  If UCase(Mid(Trim(Cells(ii,  1 )),  1 ,  8 )) = "BUILDING" Then
    Cells(ii,  1 ).Select
    Selection.HorizontalAlignment = xlRight
  End If
  
  'if col(1) is a group #, then clear the cell - based on ZZ for charge desc
  If UCase(Mid(Trim(Cells(ii,  2 )),  1 ,  2 )) = "ZZ" Then
    Cells(ii,  1 ).Select
      Selection.ClearContents
    sChargeDesc = Mid(Trim(Cells(ii,  2 )),  3 )
    Cells(ii,  2 ) = sChargeDesc
    Cells(ii,  2 ).Select
    With Selection
        .HorizontalAlignment = xlLeft
        .IndentLevel =  2 
        .ShrinkToFit = False
        .MergeCells = False
    End With
  End If

  If UCase(Mid(Trim(Cells(ii,  1 )),  1 ,  2 )) = "XX" Then
    sChargeGroup = Mid(Trim(Cells(ii,  1 )),  3 )
    Cells(ii,  2 ) = sChargeGroup
    Cells(ii,  2 ).Select
    With Selection
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation =  0 
        .IndentLevel =  0 
        .ShrinkToFit = False
        .MergeCells = False
    End With
    Cells(ii,  1 ).Select
      Selection.ClearContents
  End If
  
  'total lines to be displayed
  If UCase(Mid(Trim(Cells(ii,  1 )),  1 ,  5 )) = "TOTAL" Then
  
       'building section totals
      'If UCase(Mid(Trim(Cells(ii, 1)), 1, 8)) <> "TOTAL XX" Then
        sTotal = UCase(Trim(Cells(ii,  1 )))
        Cells(ii,  2 ) = sTotal
        Cells(ii,  2 ).Select
          Selection.HorizontalAlignment = xlLeft
          Selection.InsertIndent - 2 
      'End If
      
      Cells(ii,  1 ).Select
      Selection.ClearContents
        'over line
      Range("D" & ii & ":E" & ii).Select
      With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
      End With
      Range("G" & ii & ":G" & ii).Select
      With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
      End With
      Range("I" & ii & ":I" & ii).Select
      With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
      End With
      Range("K" & ii & ":L" & ii).Select
      With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
      End With
      
      If UCase(Mid(Trim(Cells(ii,  2 )),  1 ,  14 )) = "TOTAL BUILDING" Or _
         UCase(Mid(Trim(Cells(ii,  2 )),  1 ,  14 )) = "TOTAL PROPERTY" Then
        'bottom underline too
        Range("D" & ii & ":E" & ii).Select
        With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
        Range("G" & ii & ":G" & ii).Select
        With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
        Range("I" & ii & ":I" & ii).Select
        With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
        Range("K" & ii & ":L" & ii).Select
        With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
        
        'add page break at the next row, col(1)
        If UCase(Mid(Trim(Cells(ii,  2 )),  1 ,  14 )) <> "TOTAL PROPERTY" Then
          Range("A" & ii +  1 ).Select
          ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
        End If
        
      End If     'building total
    End If      'totals general
 
    If UCase(Mid(Trim(Cells(ii,  2 )),  1 ,  8 )) = "TOTAL XX" And _
      Cells(ii -  2 ,  3 ) = "" Then
      Rows(CStr(ii) + ":" + CStr(ii)).Select
      Selection.Delete Shift:=xlUp
    Else
      If UCase(Mid(Trim(Cells(ii,  2 )),  1 ,  8 )) = "TOTAL XX" And _
                        Cells(ii -  2 ,  3 ) <> "" Then
      Cells(ii,  2 ) = ""
      End If
    End If
      
    If UCase(Mid(Trim(Cells(ii,  1 )),  1 ,  16 )) = "PAYMENT ANALYSIS" Then
       'NSF section
      dGrossReceipts = Cells(ii,  4 )
      dNSFReceipts = Cells(ii,  5 )
      dTotalReceipts = Cells(ii,  9 )
      'add 3 rows above to separate from property summary
      Rows(CStr(ii -  1 ) + ":" + CStr(ii +  1 )).Select
        Selection.Insert Shift:=xlDown
      ii = ii +  3 

      'insert 6 lines
      Rows(CStr(ii +  1 ) + ":" + CStr(ii +  6 )).Select
        Selection.Insert Shift:=xlDown

      'clear first line, add labels 'TOTALS' in col(9), double lines
      Range("A" & ii & ":L" & ii).Select
      Selection.ClearContents
      Cells(ii,  2 ) = "PAYMENTS ANALYSIS"
      Cells(ii,  9 ) = "TOTAL"
      Range("I" & ii & ":I" & ii).Select
      With Selection
        .HorizontalAlignment = xlRight
      End With
      
      Range("B" & ii & ":I" & ii).Select
        With Selection.Borders(xlEdgeTop)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
      Range("B" & ii & ":I" & ii).Select
        With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
        
      'put Gross receipts cell ii + 2, 9, 'PAYMENTS'
      Cells(ii +  2 ,  9 ) = dGrossReceipts
      Cells(ii +  2 ,  2 ) = "PAYMENTS"
      
      'put NSF cells(ii + 3, 9) 'NSF RETURNS'
      Cells(ii +  3 ,  9 ) = dNSFReceipts
      Cells(ii +  3 ,  2 ) = "NSF RETURNS"
      
      Range("B" & ii +  2  & ":B" & ii +  3 ).Select
      With Selection
        .HorizontalAlignment = xlLeft
        .IndentLevel =  4 
      End With


      'put total (ii + 5, 9), double lines 'TOTAL PAYMENTS
      Cells(ii +  5 ,  9 ) = dTotalReceipts
      Cells(ii +  5 ,  2 ) = "TOTAL PAYMENTS"
      Range("B" & ii +  5  & ":I" & ii +  5 ).Select
        With Selection.Borders(xlEdgeTop)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
      Range("B" & ii +  5  & ":I" & ii +  5 ).Select
        With Selection.Borders(xlEdgeBottom)
          .LineStyle = xlContinuous
          .Weight = xlThin
          .ColorIndex = xlAutomatic
        End With
        
      'Rows(CStr(iRowX) + ":" + CStr(iRowX)).Select
      'Selection.RowHeight = 11.25
      'Rows(CStr(iRowY) + ":" + CStr(iRowY)).Select
      'Selection.RowHeight = 11.25
      iRowX = ii
      iRowY = ii +  5 
      
      ii = ii +  5 
    End If
  
    ii = ii +  1 
  Wend
  
 'delete grand total line
 'Mid(Cells(ii, 1), 1, 11) <> "Grand Total"
  Rows(CStr(ii -  2 ) + ":" + CStr(ii)).Select
  Selection.Delete Shift:=xlUp
  


'HEADING ****  Add ColA, O
    Columns("A:A").Select
    Selection.Insert Shift:=xlToRight
    Columns("A:A").ColumnWidth =  1 #
    Columns("O:O").ColumnWidth =  1 #
    
'Set Row Heighth
    Rows("1:3").RowHeight =  9 #

'set data font size & row heighth
  Range("A1:M" & ii +  4 ).Select
    Selection.Font.Size =  6 
  Rows("3:" & ii +  4 ).Select
    Selection.RowHeight =  8 . 5 
    
  Rows(CStr(iRowX) + ":" + CStr(iRowX)).Select
    Selection.RowHeight =  11 . 25 
  Rows(CStr(iRowY) + ":" + CStr(iRowY)).Select
    Selection.RowHeight =  11 . 25 
    

 
        'Center and shade heading box
    Range("E1:O3").Select
    With Selection
        .HorizontalAlignment = xlCenter
    End With
    
    

    Range("A1:O3").Select
    With Selection.Interior
        .ColorIndex =  36 
        .Pattern = xlSolid
    End With
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
  






End Sub
Sub CheckFlag()
Dim ip As Integer

  bOutFile = False
  Windows("ro_Collection_Status_Summary.csv").Activate
  
  For ip =  1  To  2 
    If UCase(Cells(ip,  1 )) = "PRINT" Then
      bPrint = True
      Rows(CStr(ip) + ":" + CStr(ip)).Select
        Selection.Delete Shift:=xlUp
    End If
  Next ip
   
  If InStr(Cells( 1 ,  1 ), ":\") >  0  Then
    bOutFile = True
  Else
    Rows("1").Insert
  End If
  
  
End Sub
Sub OutFile()

  'Copy Sheet1 to a new workbook in the directory from
  'the cell A1 in the csv file. Copy without the macros.
  'Then close Workbook .
    
    
    Sheets("Sheet1").Select
    Sheets("Sheet1").Copy
    Workbooks( 2 ).Activate

    'If Dir(sOutFile) <> "" Then Kill sOutFile
    ActiveWorkbook.SaveAs Filename:=sOutFile, FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
    
    'Windows(Dir(sOutFile)).Activate
    ActiveWorkbook.Close ( 0 )
        
End Sub

Sub TitleFormat()
'
' TitleFormat recorded 10/12/1999
'

'Insert top 10 rows
    Rows("1:10").Select
    Selection.Insert Shift:=xlDown
'Set row heighths
    Rows("1:1").Select
    Selection.RowHeight =  7 . 5 
    Rows("2:8").Select
    Selection.RowHeight =  8 . 75 
    Rows("9:9").Select
    Selection.RowHeight =  7 . 5 
    Rows("10:10").Select
    Selection.RowHeight =  9 #
    
'Put bold box around all top 9 rows
    Range("A1:O9").Select
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThick
        .ColorIndex = xlAutomatic
    End With
'put light box around inside edge
    Range("B2:N8").Select
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
'Add right side title text, bold

    Cells( 3 ,  14 ) = "SCHEDULE 9C"
    Cells( 4 ,  14 ) = "    -SUMMARIES"
    Cells( 5 ,  14 ) = sTitle4
    Cells( 6 ,  14 ) = sAddr1
    Cells( 7 ,  14 ) = sCsz

    Range("N3:N7").Select
    Selection.Font.Bold = True
    With Selection.Font
        .Name = "Arial"
        .Size =  6 
    End With
    Selection.HorizontalAlignment = xlLeft

    
'Add title box

    ActiveSheet.Shapes.AddShape(msoShapeRectangle,  206 . 25 ,  14 . 25 ,  276 . 75 ,  45 #). _
        Select
    Selection.Characters.Text = _
        sTitle1 & Chr( 10 ) & sTitle2 & Chr( 10 ) & sTitle3
    With Selection.Characters(Start:= 1 , Length:= 115 ).Font
        .Name = "Arial"
        .FontStyle = "Bold"
        .Size =  12 
    End With
    Selection.HorizontalAlignment = xlCenter
    
'Add shading to edge of title
    Range("A1:O1").Select
    Selection.Interior.ColorIndex =  36 
    Range("A9:O9").Select
    Selection.Interior.ColorIndex =  36 

    Range("O1:O9").Select
    Selection.Interior.ColorIndex =  36 
    Range("A1:A9").Select
    Selection.Interior.ColorIndex =  36 

End Sub

Sub SheetFormat()
'
' Macro recorded 10/12/1999 by LK
'

'
    With ActiveSheet.PageSetup
        .LeftHeader = ""
        .CenterHeader = ""
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = "&""Arial,Bold""&8PAGE   &P of &N"
        .RightFooter = ""
        .LeftMargin = Application.InchesToPoints( 0 . 5 )
        .RightMargin = Application.InchesToPoints( 0 . 5 )
        .TopMargin = Application.InchesToPoints( 0 . 3 )
        .BottomMargin = Application.InchesToPoints( 0 . 51 )
        .HeaderMargin = Application.InchesToPoints( 0 . 62 )
        .FooterMargin = Application.InchesToPoints( 0 . 2 )
        .PrintHeadings = False
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments
       ' .PrintQuality = 600
        .CenterHorizontally = True
        .CenterVertically = False
        .Orientation = xlLandscape
        .Draft = False
        .PaperSize = xlPaperLetter
        .FirstPageNumber = xlAutomatic
        .Order = xlDownThenOver
        .BlackAndWhite = False
        .Zoom =  100 
    End With
        'set repeating title with 1 extra row for clear space
    With ActiveSheet.PageSetup
        .PrintTitleRows = "$1:$14"
    End With
    
    
        'merge opening/closing balance headers
    Range("L11:M11").Select    'closing
    With Selection
        .HorizontalAlignment = xlCenter
        .MergeCells = False
    End With
    Selection.Merge
    Range("L12:M12").Select     'closing balance
    With Selection
        .HorizontalAlignment = xlCenter
        .MergeCells = False
    End With
    Selection.Merge
    Range("E11:F11").Select     'opening
    With Selection
        .HorizontalAlignment = xlCenter
         .MergeCells = False
    End With
    Selection.Merge
    Range("E12:F12").Select     'opening balance
    With Selection
        .HorizontalAlignment = xlCenter
        .MergeCells = True
    End With
    Selection.Merge


End Sub

Sub Add_Logo()
'
' Macro2 Macro
' Macro recorded 05/25/2000 by ysi
' logo must be in default path L:\yardi\sdefpath

'
    ActiveSheet.Pictures.Delete
   
    Range("B3").Select
    ActiveSheet.Pictures.Insert("L:\yardi\sdefpath\logo_irg.gif").Select
    Selection.ShapeRange.ScaleWidth  0 . 9 , msoFalse, msoScaleFromBottomRight
    Selection.ShapeRange.ScaleWidth  0 . 83 , msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleHeight  0 . 81 , msoFalse, msoScaleFromTopLeft
    Range("B10").Select

End Sub




...
Рейтинг: 0 / 0
VB error in PT_EndRpt - Method '~' of object '~' failed
    #36000870
Фотография big-duke
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Указанного вами метода PT_EndRpt в приведенном коде нет.
Для трассировки используйте обработчик ошибок ( on error goto) и брейкпойнты ( F9).
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / VB error in PT_EndRpt - Method '~' of object '~' failed
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]