A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Problem in saving a Presentation using VBA Macro
Joined: Nov 01, 2011
Feb 29, 2012 00:13:13
I have written a macro in
.pptx file, which fires when ever a user Press on 'Save' button and SaveAs Dialog will appear.
And Filename in SaveAs dialog box will be coming automatically and appending Time step to that file.
But I can not save that Presentation.
Follow is my code:
Private Sub PPTEvent_PresentationBeforeSave(ByVal Pres As Presentation, Cancel As Boolean) Dim dlgSaveAs As FileDialog Dim strMyFile As String Dim strTmp As String Set dlgSaveAs = Application.FileDialog(Type:=msoFileDialogSaveAs) strMyFile = "Title" & "_" & "SubTitle" strTmp = strMyFile & Format(Date, "yyyy_mm_dd") With dlgSaveAs .InitialFileName = strMyFile & Format(Date, "yyyy_mm_dd") If .Show = -1 Then strTmp = .SelectedItems(1) MsgBox (strTmp) ' Error comes at this point, Error : Run Time Error - 2147467259 (80004005) Presentation (Unknown Number) Pres.SaveAs FileName:=strTmp, FileFormat:=ppSaveAsDefault strTmp = strMyFile '-- save your file to strMyFile here Else Cancel = True MsgBox "File was not saved." '-- The user pressed Cancel. End If End With Set dlgSaveAs = Nothing Set cPPTObject.PPTEvent = Nothing End Sub
Joined: Nov 20, 2011
Feb 29, 2012 00:59:13
What Visual basic Application (Scripting) has to to with
Language ?? Hint Hint !!! Wrong Forum
rocket mass heater
subject: Problem in saving a Presentation using VBA Macro
raw xml as the payload
Problem in communication bet'n vb client and java server
Word Macros doesnt works when using JRun as a Service
Save a query to a string
JfileChooser selecting existing file.......?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015