
No.4ベストアンサー
- 回答日時:
お、まだあきらめないんですね。
難しいでしょうが、がんばってください。
Sub pp_Print4()
Dim objPPT As Object '参照設定していればPowerPoint.Application
Dim myPre As Object 'PowerPoint.Presentation
Dim myName As String
Dim n As Long
myName = "E:\office\powerpoint\0.ppt" 'ファイル名
Set objPPT = CreateObject("PowerPoint.Application")
With objPPT
.Visible = True
On Error GoTo Err_Hnd
'ファイル開いているとき
Set myPre = .Presentations(myName)
GoTo tugi
Err_Hnd:
'ファイル開いていないとき
Set myPre = .Presentations.Open(myName)
tugi:
On Error GoTo 0
End With
With myPre
'用紙に合わせる
.PrintOptions.FitToPage = msoTrue
.PrintOut '印刷
DoEvents
.Close 'ファイル閉じる
End With
'PowerPoint終了
objPPT.Quit
Set myPre = Nothing
Set objPPT = Nothing
End Sub
No.3
- 回答日時:
pp_Print3で.Closeを忘れました。
↓こっちでお願いします。
Sub pp_Print3()
Dim myPre As Object 'powerpoint.Presentation
Dim n As Long
'ファイル名指定する場合
On Error GoTo Err_Hnd
Set myPre = GetObject("E:\office\powerpoint\0.ppt")
On Error GoTo 0
With myPre
.Application.Visible = True
With .PrintOptions
'用紙に合わせる
.FitToPage = msoTrue
End With
.PrintOut '印刷
DoEvents
.Close
End With
Err_Hnd:
Set myPre = Nothing
End Sub
この回答への補足
ありがとうございます。
パワーポイントの「閉じる」ですが、開いている特定のファイルは閉じますが、パワーポイントのソフト自体が残ってしまいます。
パワーポイント自体を閉じるにはどうすればいいのでしょうか?
No.2
- 回答日時:
Sub pp_Print2()
Dim objPPT As Object '参照設定していればpowerpoint.Application
Dim n As Long
'起動しているPowerPoint取得
On Error GoTo Err_Hnd
Set objPPT = GetObject(, "PowerPoint.Application")
On Error GoTo 0
With objPPT.Presentations(1) 'ひとつ目のファイルだけ
With .PrintOptions
'用紙に合わせる
.FitToPage = msoTrue
End With
.PrintOut '印刷
DoEvents
End With
Err_Hnd:
Set objPPT = Nothing
End Sub
Sub pp_Print3()
Dim myPre As Object 'powerpoint.Presentation
Dim n As Long
'ファイル名指定する場合
On Error GoTo Err_Hnd
Set myPre = GetObject("E:\office\powerpoint\0.ppt")
On Error GoTo 0
With myPre
With .PrintOptions
'用紙に合わせる
.FitToPage = msoTrue
End With
.PrintOut '印刷
DoEvents
End With
Err_Hnd:
Set myPre = Nothing
End Sub
No.1
- 回答日時:
開いているファイルをすべて印刷するなら..
Sub pp_Print()
Const ppPrintOutputSixSlideHandouts = 4
Dim objPPT As Object 'パワポに参照設定ならPowerPoint.Application
Dim myPre As Object 'PowerPoint.Presentation
Dim n As Long
'起動しているPowerPoint取得
On Error GoTo Err_Hnd
Set objPPT = GetObject(, "PowerPoint.Application")
On Error GoTo 0
With objPPT.Presentations
For n = 1 To .Count '開いているプレゼンループ
With .Item(n)
With .PrintOptions
'1枚に6スライド(例です)
.OutputType = ppPrintOutputSixSlideHandouts
'用紙に合わせる
.FitToPage = msoTrue
End With
.PrintOut '印刷
DoEvents
End With
Next n
End With
Err_Hnd:
Set objPPT = Nothing
End Sub
新しく開くならCreateObjectを使うことも。
この回答への補足
ありがとうございます。
特定のパワーポイントファイル1つを印刷するにはどうすればいいでしょうか?
また、1ページに1スライドのみ印刷したいのですが、どうすればいいでしょうか?
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
このQ&Aを見た人はこんなQ&Aも見ています
関連するカテゴリからQ&Aを探す
おすすめ情報
このQ&Aを見た人がよく見るQ&A
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
動かなくなってしまった古いVBA...
-
VB6でUTF-8ファイルの読取りを
-
vbs ブック共有を解除
-
エクセルのVBAで開いている...
-
「エクセルファイルが開いてい...
-
サブフォルダ含むフォルダ内の...
-
EXCEL VBAを使ったファイル解析...
-
Long型で表現できないファイル...
-
「AccessViolationException」...
-
ffftpでファイル取得が0バイト...
-
エクセルのプロパティーでセキ...
-
エクセルvbaでdocuworksprinter...
-
ExcelブックをGoogleスプレッド...
-
xcopyコマンドの進行状況を表示...
-
カンマ区切りのCSVファイルから...
-
エクセルVBAで一つ上の階層...
-
ExcelのVBAでフォルダ指定がで...
-
Excel 相対パス
-
EXCEL 検索時の設定
-
frxファイルの役目
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
動かなくなってしまった古いVBA...
-
「エクセルファイルが開いてい...
-
excel マクロ PDF化の際のエラ...
-
ffftpでファイル取得が0バイト...
-
VBAでフォルダ内のhtmlファイル...
-
EXCEL VBAを使ったファイル解析...
-
VB6でUTF-8ファイルの読取りを
-
AccessからOLEオブジェクト型の...
-
複数のワークブックのVBAを変更...
-
サブフォルダ含むフォルダ内の...
-
vbaサブフォルダーをワイルドカ...
-
タイムスタンプの更新の方法2
-
VBからExcelファイルを開くとき...
-
VBAでCSVファイルを読み込もう...
-
FileDialog オブジェクトでファ...
-
vbsでのアスタリスクとファイル...
-
VBA、ファイル名検索から開く、...
-
フォルダ階層・ファイル名・ペ...
-
webブラウザからローカルファイ...
-
ファイルを複数選択した時のフ...
おすすめ情報