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も見ています
-
フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
あなたが普段思っている「これまだ誰も言ってなかったけど共感されるだろうな」というあるあるを教えてください
-
フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
あなたが普段思っている「これまだ誰も言ってなかったけど共感されるだろうな」というあるあるを教えてください
-
映画のエンドロール観る派?観ない派?
映画が終わった後、すぐに席を立って帰る方もちらほら見かけます。皆さんはエンドロールの最後まで観ていきますか?
-
海外旅行から帰ってきたら、まず何を食べる?
帰国して1番食べたくなるもの、食べたくなるだろうなと思うもの、皆さんはありますか?
-
天使と悪魔選手権
悪魔がこんなささやきをしていたら、天使のあなたはなんと言って止めますか?
-
EXCEL-VBAからPowerPointファイルを開いてPDF印刷する方法?
その他(Microsoft Office)
-
ExcelVBAにて既に開かれているPowerpointをアクティブにするには?
Excel(エクセル)
-
エクセルVBAを使用し、指定のパワーポイントをPDF保存する方法
Excel(エクセル)
-
-
4
パワーポイントのVBAでテキストボックスに値を変更させたいです
Visual Basic(VBA)
-
5
VBAでアクティブなファイルを切り替える
PowerPoint(パワーポイント)
-
6
PowerPoint の VBA
Visual Basic(VBA)
-
7
VBAで保存しないで閉じると空のBookが残る
Excel(エクセル)
関連するカテゴリからQ&Aを探す
おすすめ情報
- ・漫画をレンタルでお得に読める!
- ・人生のプチ美学を教えてください!!
- ・10秒目をつむったら…
- ・あなたの習慣について教えてください!!
- ・牛、豚、鶏、どれか一つ食べられなくなるとしたら?
- ・【大喜利】【投稿~9/18】 おとぎ話『桃太郎』の知られざるエピソード
- ・街中で見かけて「グッときた人」の思い出
- ・「一気に最後まで読んだ」本、教えて下さい!
- ・幼稚園時代「何組」でしたか?
- ・激凹みから立ち直る方法
- ・1つだけ過去を変えられるとしたら?
- ・【あるあるbot連動企画】あるあるbotに投稿したけど採用されなかったあるある募集
- ・【あるあるbot連動企画】フォロワー20万人のアカウントであなたのあるあるを披露してみませんか?
- ・映画のエンドロール観る派?観ない派?
- ・海外旅行から帰ってきたら、まず何を食べる?
- ・誕生日にもらった意外なもの
- ・天使と悪魔選手権
- ・ちょっと先の未来クイズ第2問
- ・【大喜利】【投稿~9/7】 ロボットの住む世界で流行ってる罰ゲームとは?
- ・推しミネラルウォーターはありますか?
- ・都道府県穴埋めゲーム
- ・この人頭いいなと思ったエピソード
- ・準・究極の選択
このQ&Aを見た人がよく見るQ&A
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
VBAでフォルダ内のhtmlファイル...
-
vbaサブフォルダーをワイルドカ...
-
動かなくなってしまった古いVBA...
-
タイムスタンプの更新の方法2
-
コモンダイアログで拡張子の無...
-
複数のワークブックのVBAを変更...
-
excel マクロ PDF化の際のエラ...
-
エクセルのVBAで開いている...
-
ffftpでファイル取得が0バイト...
-
FileDialog オブジェクトでファ...
-
【ACCESS VBA】アクセスからデ...
-
VB.net XMLの作成方法 Iniの代替
-
ExcelVBA 文字コード変換
-
「エクセルファイルが開いてい...
-
音量調節プログラムについて
-
フォルダ内のファイル存在監視...
-
ファイルへのハイパーリンクで...
-
inetコントロールを使用したFTP...
-
ファイルを開く時間測定のスク...
-
EXCEL VBAを使ったファイル解析...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
vbaサブフォルダーをワイルドカ...
-
動かなくなってしまった古いVBA...
-
vbs ブック共有を解除
-
サブフォルダ含むフォルダ内の...
-
ExcelVBA 文字コード変換
-
Accessのウインドウサイズの固定
-
FileDialog オブジェクトでファ...
-
「エクセルファイルが開いてい...
-
vbsでのアスタリスクとファイル...
-
VB6でUTF-8ファイルの読取りを
-
ffftpでファイル取得が0バイト...
-
excel マクロ PDF化の際のエラ...
-
VBAでフォルダ内のhtmlファイル...
-
エクセルのVBAで開いている...
-
ファイルを開く時間測定のスク...
-
Long型で表現できないファイル...
-
複数のワークブックのVBAを変更...
-
VBからExcelファイルを開くとき...
-
【ACCESS VBA】アクセスからデ...
-
VBA、ファイル名検索から開く、...
おすすめ情報