2016-02-02 69 views
1

textPositionOFf我正在VB6中生成報告以便在Microsoft Word中打印。我看到一些問題不應該發生,因爲我正在處理已經存在的報告。我基本上正在創建一個報告,我正在做我自己的報告。我有一個快速的函數來創建一個標題,我傳遞參數,主要是標題的行號和文本。使用VB6的Microsoft Word報告問題

對於應用邊框的三行代碼,我得到一個錯誤,說「5941 - 請求的成員集合不存在」我正在看另一個報告,它看起來和我的一樣,但我還沒有會得到這個錯誤。有誰知道可能是什麼問題?

Private Sub TableStyle_001_HeaderLine(row As Integer, Col1Txt As String) 
    On Error GoTo error_handler: 
    w_Doc.Tables.Add w_Rng, 1, 1 

    w_Wrd.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter 
    With w_Wrd.Selection.Tables(w_DocTblIdx).Rows(row) 
    With .Shading 
     .Texture = wdTextureNone 
     .ForegroundPatternColor = wdColorAutomatic 
     .BackgroundPatternColor = wdColorGray15 
    End With 
    With .Borders(wdBorderLeft) 
     .LineStyle = wdLineStyleSingle 
     .LineWidth = wdLineWidth050pt 
     .Color = wdColorAutomatic 
    End With 
    With .Borders(wdBorderRight) 
     .LineStyle = wdLineStyleSingle 
     .LineWidth = wdLineWidth050pt 
     .Color = wdColorAutomatic 
    End With 
    With .Borders(wdBorderTop) 
     .LineStyle = wdLineStyleSingle 
     .LineWidth = wdLineWidth050pt 
     .Color = wdColorAutomatic 
    End With 
    With .Borders(wdBorderBottom) 
     .LineStyle = wdLineStyleSingle 
     .LineWidth = wdLineWidth050pt 
     .Color = wdColorAutomatic 
    End With 

    .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone 'error here 
    .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone 'here 
    .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone 'and here 
    .Borders.Shadow = False 

    'WRITE THE DATA 
    .Cells(1).Select 
    w_Wrd.Selection.Font.Bold = True 
    w_Wrd.Selection.TypeText Col1Txt 


    End With 
+0

但是我得等上90分鐘:( – SamSam7

+0

當你獲得聲望的時候,事情會變得更好:-)這個限制是爲了讓新手有機會學習指導方針並適應環境。 –

回答

1

如果該表在單元格中沒有對話行,或者代碼的對象是早期版本的不支持對角線的Word,則這些代碼行是不必要的。如果這個報告沒有被任何可以向表格單元格添加對角線的人編輯,那麼請註釋這些行是否與報告代碼具有不同的「化身」,但這些代碼不是必需的工作。