Brain Dead 
Author Message
 Brain Dead

Chaps

It's got to that point in the afternoon....

I'm trying to run a userdefined PowerPoint VBA function from within Access,
and I can't think what the syntax would be - see below.

Dim dbsCurr As Database
Dim rstCurr As Recordset
Dim strCode As String
Dim strCmpy As String
Dim opptApp As PowerPoint.Application
Dim opptPres As PowerPoint.Presentation

Set dbsCurr = CurrentDb()
Set rstCurr = dbsCurr.OpenRecordset("tblMicroParts")

Do Until rstCurr.EOF

strCode = rstCurr("CmpyCode")
strCmpy = rstCurr("CompanyName")

Set opptApp = CreateObject("PowerPoint.Application")

opptApp.Visible = True

opptApp.Presentations.Open
"F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\MicroCmpyChpt3Tes
t.ppt", False

Set opptPres = opptApp.ActivePresentation

'opptPres.AutoCmpy(strCode, strCmpy) - THIS IS WHERE IT ALL GOES WRONG,
Access doesn't know what function is.

opptPres.SaveCopyAs
"F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\" & strCode & "\"
& strCode & "Chp3.ppt"

opptApp.Quit

rstCurr.MoveNext

Loop

I'm sure this must be easy!

Any help greatly appreciated.

Cheers

Andy



Sat, 23 Oct 2004 23:35:47 GMT  
 Brain Dead
Is your function defined as "Public"? If not, and it is not in the same
module, you will not be able to see it.

--
HTH,

Justin

Unless one is willing to risk
making a fool of themselves,
one can not learn.


Quote:
> Chaps

> It's got to that point in the afternoon....

> I'm trying to run a userdefined PowerPoint vba function from within
Access,
> and I can't think what the syntax would be - see below.

> Dim dbsCurr As Database
> Dim rstCurr As Recordset
> Dim strCode As String
> Dim strCmpy As String
> Dim opptApp As PowerPoint.Application
> Dim opptPres As PowerPoint.Presentation

> Set dbsCurr = CurrentDb()
> Set rstCurr = dbsCurr.OpenRecordset("tblMicroParts")

> Do Until rstCurr.EOF

> strCode = rstCurr("CmpyCode")
> strCmpy = rstCurr("CompanyName")

> Set opptApp = CreateObject("PowerPoint.Application")

> opptApp.Visible = True

> opptApp.Presentations.Open

"F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\MicroCmpyChpt3Tes

- Show quoted text -

Quote:
> t.ppt", False

> Set opptPres = opptApp.ActivePresentation

> 'opptPres.AutoCmpy(strCode, strCmpy) - THIS IS WHERE IT ALL GOES WRONG,
> Access doesn't know what function is.

> opptPres.SaveCopyAs
> "F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\" & strCode &
"\"
> & strCode & "Chp3.ppt"

> opptApp.Quit

> rstCurr.MoveNext

> Loop

> I'm sure this must be easy!

> Any help greatly appreciated.

> Cheers

> Andy



Sun, 24 Oct 2004 00:30:23 GMT  
 Brain Dead
Hi

I've created a module in PowerPoint and AutoCmpy is a Public Function I've
created in that module.

I guess I'm just using the wrong syntax to call the function?

Cheers

Andy



Quote:
> Is your function defined as "Public"? If not, and it is not in the same
> module, you will not be able to see it.

> --
> HTH,

> Justin

> Unless one is willing to risk
> making a fool of themselves,
> one can not learn.



> > Chaps

> > It's got to that point in the afternoon....

> > I'm trying to run a userdefined PowerPoint vba function from within
> Access,
> > and I can't think what the syntax would be - see below.

> > Dim dbsCurr As Database
> > Dim rstCurr As Recordset
> > Dim strCode As String
> > Dim strCmpy As String
> > Dim opptApp As PowerPoint.Application
> > Dim opptPres As PowerPoint.Presentation

> > Set dbsCurr = CurrentDb()
> > Set rstCurr = dbsCurr.OpenRecordset("tblMicroParts")

> > Do Until rstCurr.EOF

> > strCode = rstCurr("CmpyCode")
> > strCmpy = rstCurr("CompanyName")

> > Set opptApp = CreateObject("PowerPoint.Application")

> > opptApp.Visible = True

> > opptApp.Presentations.Open

"F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\MicroCmpyChpt3Tes

- Show quoted text -

Quote:
> > t.ppt", False

> > Set opptPres = opptApp.ActivePresentation

> > 'opptPres.AutoCmpy(strCode, strCmpy) - THIS IS WHERE IT ALL GOES WRONG,
> > Access doesn't know what function is.

> > opptPres.SaveCopyAs
> > "F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\" & strCode &
> "\"
> > & strCode & "Chp3.ppt"

> > opptApp.Quit

> > rstCurr.MoveNext

> > Loop

> > I'm sure this must be easy!

> > Any help greatly appreciated.

> > Cheers

> > Andy



Sun, 24 Oct 2004 16:15:08 GMT  
 Brain Dead
Andy,

The value returned by the Function must be assigned to a variable:

 Dim X as String
 X = opptPres.AutoCmpy(strCode, strCmpy)

Regards,

Jim Cone
San Jose, CA

*************************************************************************

Quote:

> Hi
> I've created a module in PowerPoint and AutoCmpy is a Public Function I've
> created in that module.
> I guess I'm just using the wrong syntax to call the function?
> Cheers

> Andy


> > > Chaps
> > > It's got to that point in the afternoon....
> > > I'm trying to run a userdefined PowerPoint vba function from within Access,

and I can't think what the syntax would be - see below.

Quote:
> > > Dim dbsCurr As Database
> > > Dim rstCurr As Recordset
> > > Dim strCode As String
> > > Dim strCmpy As String
> > > Dim opptApp As PowerPoint.Application
> > > Dim opptPres As PowerPoint.Presentation
> > > Set dbsCurr = CurrentDb()
> > > Set rstCurr = dbsCurr.OpenRecordset("tblMicroParts")
> > > Do Until rstCurr.EOF
> > > strCode = rstCurr("CmpyCode")
> > > strCmpy = rstCurr("CompanyName")
> > > Set opptApp = CreateObject("PowerPoint.Application")
> > > opptApp.Visible = True
> > > opptApp.Presentations.Open
>  "F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\MicroCmpyChpt3Tes
> > > t.ppt", False

> > > Set opptPres = opptApp.ActivePresentation
> > > 'opptPres.AutoCmpy(strCode, strCmpy) - THIS IS WHERE IT ALL GOES WRONG,
> > > Access doesn't know what function is.
> > > opptPres.SaveCopyAs
> > > "F:\AutoReports\MacroMicro2001\BM2001CmpySpecific\Clinical\" & strCode &
>  "\"
> > > & strCode & "Chp3.ppt"
> > > opptApp.Quit

> > > rstCurr.MoveNext
> > > Loop

I'm sure this must be easy!
 Any help greatly appreciated.
 Cheers
 Andy


Mon, 25 Oct 2004 01:48:55 GMT  
 Brain Dead
Correct me if I am wrong but I don't think that you can call the VBA
function direct using the presentation. You have to use Application.Run()
method.

- Chirag

  Shortcut Manager - Assign keyboard shortcuts to menu items and macros
  http://officerone.tripod.com/ppsctmgr/ppsctmgr.html


Quote:
> Andy,

> The value returned by the Function must be assigned to a variable:

>  Dim X as String
>  X = opptPres.AutoCmpy(strCode, strCmpy)

> Regards,

> Jim Cone
> San Jose, CA

> *************************************************************************



Mon, 25 Oct 2004 04:44:53 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Wanted: non-brain-dead class builder util for VB6

2. Datagrid Control - BRAIN DEAD

3. Gone Brain Dead!

4. dbcombo acting brain-dead

5. WINSOCK Sending Brain-Dead SMTP packets

6. Re-Request Brain Dead

7. Help - Brain Dead

8. Gone Brain Dead!

9. How do I convert Binary to an Integer or Long in VB, Im brain dead today!

10. Date/time algorithm for holidays (brain teaser?)

11. a synchronization brain teaser...

12. Are the real brains in this group?

 

 
Powered by phpBB® Forum Software