Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Macro to generate powerpoint slides

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()
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Macro to generate powerpoint slides

Sorry.., my bad copy/paste. Should be...

Sub CreatePowerPoint()
Dim vList, n&

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 vList(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&

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 & vList(n), .slides.Count + 1
Next 'n
End With 'Application.Presentations.Add
Cleanup:
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Macro to generate powerpoint slides

no worries,

I fixed the copy and paste part but I am still not getting the slides to come up when running CreatePowerPoint. And now when I run InserSlidesFromFile nothing happens. Weird.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Macro to generate powerpoint slides

no worries,

I fixed the copy and paste part but I am still not getting the slides
to come up when running CreatePowerPoint. And now when I run
InserSlidesFromFile nothing happens. Weird.


This is where you need to get help in a PPT forum...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Macro to generate powerpoint slides

I am already on it. :) We are close, but missing a open hyperlink function of some sort.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Macro to generate powerpoint slides

I am already on it. :) We are close, but missing a open hyperlink
function of some sort.


I don't understand why you think you need hyperlinks. Everything I
coded for just requires a full path...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Macro to generate powerpoint slides

hi,

Le 2014-08-27 13:38, Marty Girvan a écrit :
I am already on it. :) We are close, but missing a open hyperlink function of some sort.


Sub appPPT()
Dim oPPT As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Dim oSlide As PowerPoint.Slide
Dim oShape As PowerPoint.Shape

Set oPPT = CreateObject("PowerPoint.Application")
Set oPres = oPPT.Presentations.Add(msoTrue)
Set oSlide = oPres.Slides.Add(1, ppLayoutBlank)
Set oShape = oSlide.Shapes.AddTextbox(msoTextOrientationHorizon tal, 10, 10, 256, 28)

With oShape.TextFrame.TextRange
.Text = "http//www.google.com"
.ActionSettings(ppMouseClick).Hyperlink.Address = "http://www.google.com/"
End With

oPPT.Visible = msoTrue
End Sub

isabelle


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Macro to generate powerpoint slides

note that the Hyperlinks work only while a slide show presentation is running —
not while you're working on your presentation in normal view or slide sorter view

isabelle

Le 2014-08-27 22:13, isabelle a écrit :
hi,

Le 2014-08-27 13:38, Marty Girvan a écrit :
I am already on it. :) We are close, but missing a open hyperlink function
of some sort.


Sub appPPT()
Dim oPPT As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Dim oSlide As PowerPoint.Slide
Dim oShape As PowerPoint.Shape

Set oPPT = CreateObject("PowerPoint.Application")
Set oPres = oPPT.Presentations.Add(msoTrue)
Set oSlide = oPres.Slides.Add(1, ppLayoutBlank)
Set oShape = oSlide.Shapes.AddTextbox(msoTextOrientationHorizon tal, 10, 10, 256,
28)

With oShape.TextFrame.TextRange
.Text = "http//www.google.com"
.ActionSettings(ppMouseClick).Hyperlink.Address = "http://www.google.com/"
End With

oPPT.Visible = msoTrue
End Sub

isabelle


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint slides from Excel pages Tigerxxx Excel Discussion (Misc queries) 2 March 16th 09 08:06 PM
where do u get slides for microsoft powerpoint 2003? slides for microsoft powerpoint 2003 Excel Discussion (Misc queries) 2 October 16th 08 02:00 PM
Powerpoint slides to be used in excel macros Vijay Kotian Excel Discussion (Misc queries) 1 November 30th 06 07:44 AM
Excel formulas on different Powerpoint Slides liseladele Excel Worksheet Functions 0 June 1st 06 12:28 AM
Generate powerpoint slides from excel automatically Héctor Balanzar Excel Programming 1 December 31st 03 01:16 PM


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"