Hi all,
I have data in an Excel file that needs to be displayed as a table in PowerPoint. I'm still working on the code for that, but in the meantime, I was trying to write the code to SAVE that powerpoint file once it is created.
Below is the code I'm using, but I'm mostly frustrated by the fact that I don't understand what the Intellisense is trying to get me to do. The line here
which is toward the bottom of the code, is where I'm having trouble. The IntelliSense says
SaveAs(FileName As String, [FileFormat as PpSaveAsFileType=ppSaveAsDefault],[EmbedTrueTypeFonts as MsoTriState = msoTriStateMixed]
Can anyone help me understand what it is I'm doing wrong? I've tried this a variety of ways, and I keep getting a compile error. The only way it works is it I just use the FileName parameter, but then it shows up as saving the powerpoint as an excel file, which then doesn't open b/c it's not a supported format (obviously).
Thanks in Advance!
I have data in an Excel file that needs to be displayed as a table in PowerPoint. I'm still working on the code for that, but in the meantime, I was trying to write the code to SAVE that powerpoint file once it is created.
Below is the code I'm using, but I'm mostly frustrated by the fact that I don't understand what the Intellisense is trying to get me to do. The line here
Code:
[FONT=arial]ppPres.SaveAs(Filename=sFname,[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]PpSaveAsFileType=[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]ppSaveAsPresentation,[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]msoTristate=msoTriStateMixed)[/FONT]
SaveAs(FileName As String, [FileFormat as PpSaveAsFileType=ppSaveAsDefault],[EmbedTrueTypeFonts as MsoTriState = msoTriStateMixed]
Can anyone help me understand what it is I'm doing wrong? I've tried this a variety of ways, and I keep getting a compile error. The only way it works is it I just use the FileName parameter, but then it shows up as saving the powerpoint as an excel file, which then doesn't open b/c it's not a supported format (obviously).
Thanks in Advance!
Code:
[COLOR=#000000][FONT=Courier New]Sub CreateDisplaySlide()[/FONT][/COLOR][FONT=arial]Dim ppApp As PowerPoint.Application[/FONT]
[FONT=arial]Dim ppPres As PowerPoint.Presentation[/FONT]
[FONT=arial]Dim ppSlide As PowerPoint.Slide[/FONT]
[FONT=arial]Dim ppTable As PowerPoint.Shape[/FONT]
[FONT=arial]Dim fd As FileDialog[/FONT]
[FONT=arial]Dim sFname As String[/FONT]
[FONT=arial]
Set ppApp = CreateObject("Powerpoint.[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]Application")[/FONT]
[FONT=arial]ppApp.Visible = True 'allows user to see it on the taskbar[/FONT]
[FONT=arial]ppApp.Activate 'Maximizes PowerPoint window[/FONT]
[FONT=arial]Set ppPres = ppApp.Presentations.Add 'stores reference to it as a variable[/FONT]
[FONT=arial]Set ppSlide = ppPres.Slides.Add(1, ppLayoutBlank)[/FONT]
[FONT=arial]ppSlide.Select[/FONT]
[FONT=arial]'insert code to fill in the table [/FONT][FONT=arial]'add KEY (LEGEND) to slide [/FONT][FONT=arial]'if statements about length/width [/FONT][FONT=arial]'center horizontally [/FONT][FONT=arial]'center vertically[/FONT]
[FONT=arial]
'SaveAs code
[/FONT][FONT=arial]Set fd = Application.FileDialog([/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]msoFileDialogSaveAs)[/FONT]
[FONT=arial]With fd[/FONT]
[FONT=arial] .InitialFileName = Environ("userprofile") & "\Desktop\"[/FONT]
[FONT=arial] If fd.Show = True Then[/FONT]
[FONT=arial] sMyFile = .SelectedItems(1)[/FONT]
[FONT=arial] ppPres.SaveAs(Filename=sFname,[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]PpSaveAsFileType=[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]ppSaveAsPresentation,[/FONT]<wbr style="font-family: arial, sans-serif; font-size: 12.8000001907349px;">[FONT=arial]msoTristate=msoTriStateMixed)[/FONT]
[FONT=arial] MsgBox "File was saved"[/FONT]
[FONT=arial] Else[/FONT]
[FONT=arial] MsgBox "try again"[/FONT]
[FONT=arial] End If[/FONT]
[FONT=arial]End With[/FONT]
[FONT=arial]Set fd = Nothing
[/FONT][COLOR=#000000][FONT=Courier New]
end Sub[/FONT][/COLOR]