大家帮我看看
'截屏幕用
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Sub Command1_Click()
On Error Resume Next
    '先截取屏幕
    Call keybd_event(vbKeySnapshot, 1, 0, 0) 
    DoEvents
    '放到粘贴板里
    Clipboard.GetData (vbCFBitmap)    
    Dim oWord As Word.Application
    Dim oDoc As Word.Document
    
    Set oWord = CreateObject("Word.Application")
    Set oDoc = oWord.Documents.Add
   
    '先把word文档页面设置到最大,边距都为1
    With oDoc.PageSetup
        .Orientation = wdOrientLandscape
        .TopMargin = CentimetersToPoints(1)
        .BottomMargin = CentimetersToPoints(1)
        .LeftMargin = CentimetersToPoints(1)
        .RightMargin = CentimetersToPoints(1)
    End With
    
    '再粘贴
    Selection.Paste
    '把画面居中
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    '打印本文档
    ActiveDocument.PrintOut
    '不保存
    oDoc.Saved = True
    '退出
    oDoc.Close
    
    oWord.Quit    Set oWord = Nothing
    Set oDoc = NothingEnd Sub
程序完成后进程倒是正常退出了,但是打印出来的是白纸,而且如果我在打印前加一句保存为文件的代码,打开保存后的文件发现除了截屏图片没有粘贴过来外,文档也没有居中,说明Selection.Paste    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter这两句没有执行,结束后发现粘贴板里有截屏的图片,单就是打印不了,不知道为什么,我是在vb + office 2000里写的,代码是在vb + office 2003里执行的,项目里microsoft office 11的选项也选上了,应该不会是版本的问题吧?
谢谢大家