5

私のプリンタ名は\\abc\First Floor A-Block、NE04の\ abc \ FirstFloorA-Blockという名前です。どのように印刷すればよいですか

Private oWord As Word.Application

Dim lobjDoc As Word.Document

Dim strFolder as String
Dim pd As New PrintDocument
Dim strPrintername as String
oWord = CreateObject("Word.Application")
oWord.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
oWord.ActivePrinter =strPrintername 
strFolder="D:\testdoc.prn"

'ここでは、ネットワーク上にあるプリンタの名前を付けていますが、その名前は

\ abc \ NE04の1階Aブロック:

lobjDoc = oWord.Documents.Open(CType(strFolder, Object))

lobjDoc.PageSetup.FirstPageTray = Word.WdPaperTray.wdPrinterAutomaticSheetFeed

lobjDoc.PageSetup.OtherPagesTray = Word.WdPaperTray.wdPrinterAutomaticSheetFeed

lobjDoc.PrintOut(Background:=False, Append:=False, OutputFileName:=strFolder, PrintToFile:=True)  'here its giving error about printer settings

lobjDoc.Close(SaveChanges:=False)

PrintDocumentを介してWord文書とそのすべてのコンテンツを印刷する方法はありますか?

ありがとう

4

1 に答える 1

4

これを試すことができます:

まず、Windows のプリンター設定を使用して、そのプリンターをデフォルトのプリンターとして設定します。次に、手動で Word を開き、VBA エディターを開き、すぐに表示されるウィンドウに移動して、?ActivePrinter.

これにより、Word が認識するために送信する必要があるプリンター名の正確な形式が得られるはずです。

于 2010-06-02T07:34:52.403 に答える