Phutho
Trả lời 17 năm trước
Khi nhiều file trình diễn, bạn muốn chèn nhiều file này thành một file, để làm nhanh thì bạn cần tạo một Macro trong PowerPoint , cách thức tiến hành như sau:
1. Đưa tất cả các file trình diễn của bạn vào một thư mục, ví dụ: C:\Documents and Settings\Bell\My Documents\
2. Tạo một file có tên là LIST.TXT chứa tên các file trình diễn mà bạn muốn ghép lại kết thức mỗi tên file bạn cần bấm phím Enter.
3. Mở PowerPoint
4. Bấm ALT-F11 --> cửa sổ MS Visual Basic mở ra
5. Bấm menu Insert --> chọn Module
6. Bạn cắt dán theo nội dung dưới đây vào ô Module
Sub InsertFromList()
On Error GoTo ErrorHandler
Dim sListDir As String
Dim sListFileName As String
Dim sListFilePath As String
Dim iListFileNum As Integer
Dim sBuf As String
' EDIT THESE AS NEEDED
sListFileName = "LIST.TXT" ' name of file containing files to be inserted
sListFilePath = "C:\Documents and Settings\Bell\My Documents\" ' backslash terminated path to filder containing list file
' Do we have a file open already?
If Not Presentations.Count > 0 Then
Exit Sub
End If
' If LIST.TXT file doesn't exist, create it
If Not Dir$(sListFilePath & sListFileName) <> "" Then
iListFileNum = FreeFile()
Open sListFilePath & sListFileName For Output As iListFileNum
' get file names
sBuf = Dir$(sListFilePath & "*.PPT")
While Not sBuf = ""
Print #iListFileNum, sBuf
sBuf = Dir
Wend
Close #iListFileNum
End If
iListFileNum = FreeFile()
Open sListFilePath & sListFileName For Input As iListFileNum
' Process the list
While Not EOF(iListFileNum)
' Get a line from the list file
Line Input #iListFileNum, sBuf
' Verify that the file named on the line exists
If Dir$(sBuf) <> "" Then
Call ActivePresentation.Slides.InsertFromFile(sBuf, ActivePresentation.Slides.Count)
End If
Wend
Close #iListFileNum
MsgBox "DONE!"
NormalExit:
Exit Sub
ErrorHandler:
Call MsgBox("Error:" & vbCrLf & Err.Number & vbCrLf & Err.Description, vbOKOnly, "Error inserting files")
Resume NormalExit
End Sub
7. Quay trở về PowerPoint
8. Bấm menu Tools --> chọn Macro --> chọn Macros --> chọn InsertFromList --> bấm OK