Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The entire module partially works. If I run Sub CreatePowerPoint it generates a PowerPoint presentation but it does not insert the slides form the hyperlinks in the excel sheet. Same with InsertSlidesFromFile. Any thoughts. We are so close.
I did have to add Dim vFile as I was getting some errors. So here is the new module: Option Explicit Const sPath$ = "C:\Users\marty\Documents\" Sub CreatePowerPoint() Dim vList, n& Dim vFile vList = ActiveSheet.Range("A1:A5") On Error GoTo Cleanup 'Automate a new instance of PowerPoint With CreateObject("PowerPoint.Application") .Visible = True 'Add a new presentation With .Presentations.Add 'Insert the slides into the presentation For n = LBound(vList) To UBound(vList) .slides.InsertFromFile vFile(n, 1), .slides.Count + 1 Next 'n End With '.Presentations.Add End With 'CreateObject Cleanup: End Sub Sub InsertSlidesFromFile() ' Inserts slides from a list of PPTs stored in a txt file Dim vList, n& Dim vFile vList = Split(ReadTextFile(sPath & "auto.txt"), vbCrLf) On Error GoTo Cleanup 'Add a new presentation With Application.Presentations.Add 'Insert the slides into the presentation For n = LBound(vList) To UBound(vList) .slides.InsertFromFile sPath & vFile(n), .slides.Count + 1 Next 'n End With 'Application.Presentations.Add Cleanup: End Sub Sub InsertSlidesFromFolder() ' Inserts slides from a list of PPTs stored in a txt file Dim vFile, n& vFile = Dir(sPath) On Error GoTo Cleanup 'Add a new presentation With Application.Presentations.Add 'Insert the slides into the presentation Do While Len(vFile) .slides.InsertFromFile sPath & vFile, .slides.Count + 1 vFile = Dir() Loop End With 'Application.Presentations.Add Cleanup: End Sub Function ReadTextFile$(Filename$) ' Reads large amounts of data from a text file in one single step. Dim iNum% On Error GoTo ErrHandler iNum = FreeFile(): Open Filename For Input As #iNum ReadTextFile = Space$(LOF(iNum)) ReadTextFile = Input(LOF(iNum), iNum) ErrHandler: Close #iNum: If Err Then Err.Raise Err.Number, , Err.Description End Function 'ReadTextFile() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Powerpoint slides from Excel pages | Excel Discussion (Misc queries) | |||
where do u get slides for microsoft powerpoint 2003? | Excel Discussion (Misc queries) | |||
Powerpoint slides to be used in excel macros | Excel Discussion (Misc queries) | |||
Excel formulas on different Powerpoint Slides | Excel Worksheet Functions | |||
Generate powerpoint slides from excel automatically | Excel Programming |