PDA

View Full Version : Update Powerpoint with a field in a form in Access



linkerschuh
10-18-2014, 02:26 PM
Hi,

a click on a command button on a continous form in access is supposed to open a powerpoint document, update a specific field (so overwrite the old value), and then save the powerpoint document. The button triggers the same for word documents, and there I got it to work via this code:

sDocName = "Path + document name"
WrdName = "doc name"
WrdSpPfad = "path"

Set RS = DB.OpenRecordset("Base", dbOpenDynaset)

Set wdAnw = CreateObject("Word.Application")

Set oDoc = wdAnw.Documents.Open(sDocName)

wdAnw.Visible = False

oDoc.FormFields("Text1").Result = Me!ID

oDoc.SaveAs FileName:=WrdSpPfad & WrdName & ".doc"

wdAnw.WindowState = wdWindowStateMinimize
oDoc.Close
wdAnw.Quit True
Set wdDok = Nothing
Set wdAnw = Nothing
Set oDoc = Nothing

On the receiving word doc is a text field ("Text1") which receives the Me.ID field from the access form. I tried now to do the same with powerpoint, but didnīt succeed. Any ideas how this could work?

Thanks a lot for feedback!

jonh
10-20-2014, 01:56 AM
Set ppApp = New PowerPoint.Application
Set ppPres = ppApp.Presentations.Open(StrPath, WithWindow:=msoFalse)
Set ppSld = ppPres.Slides(1)
For Each shp In ppSld.Shapes
Debug.Print shp.Name, shp.TextEffect.Text
Next

ppSld.Shapes(1).TextEffect.Text = "hello"

linkerschuh
10-22-2014, 11:22 PM
Thanks a lot! Works!