ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running a CommandButton in Excel I get this error (https://www.excelbanter.com/excel-programming/297321-running-commandbutton-excel-i-get-error.html)

Bert[_4_]

Running a CommandButton in Excel I get this error
 
When I try to open Powerpoint using a commandbutton I get
a "Run-Time Error". Here's
the Code. Can someone help me with this, Thanks:


Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
x = Shell("C:\Program Files\Microsoft
Office\Office\POWERPNT.EXE")

Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open
Filename:="U\DATA\POWER\Learning.ppt"





Bob Phillips[_6_]

Running a CommandButton in Excel I get this error
 
Is the code exactly as you show it, as we are getting wrap around.

Try this alternative

Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open _
Filename:="U\DATA\POWER\Learning.ppt"

I have lost the shell command as it seems totally superfluous.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bert" wrote in message
...
When I try to open Powerpoint using a commandbutton I get
a "Run-Time Error". Here's
the Code. Can someone help me with this, Thanks:


Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
x = Shell("C:\Program Files\Microsoft
Office\Office\POWERPNT.EXE")

Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open
Filename:="U\DATA\POWER\Learning.ppt"







Bert[_4_]

Running a CommandButton in Excel I get this error
 
I put in the code as you suggested and I still get Run
Time Error which says the "PowerPoint Can not open the
File" Do you know why this is happening?


-----Original Message-----
Is the code exactly as you show it, as we are getting

wrap around.

Try this alternative

Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open _
Filename:="U\DATA\POWER\Learning.ppt"

I have lost the shell command as it seems totally

superfluous.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bert" wrote in

message
...
When I try to open Powerpoint using a commandbutton I

get
a "Run-Time Error". Here's
the Code. Can someone help me with this, Thanks:


Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
x = Shell("C:\Program Files\Microsoft
Office\Office\POWERPNT.EXE")

Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open
Filename:="U\DATA\POWER\Learning.ppt"






.


Bob Phillips[_6_]

Running a CommandButton in Excel I get this error
 
Well that presumably means that the file does not exist.

When I tried it with a file that did exits, it worked fine.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bert" wrote in message
...
I put in the code as you suggested and I still get Run
Time Error which says the "PowerPoint Can not open the
File" Do you know why this is happening?


-----Original Message-----
Is the code exactly as you show it, as we are getting

wrap around.

Try this alternative

Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open _
Filename:="U\DATA\POWER\Learning.ppt"

I have lost the shell command as it seems totally

superfluous.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bert" wrote in

message
...
When I try to open Powerpoint using a commandbutton I

get
a "Run-Time Error". Here's
the Code. Can someone help me with this, Thanks:


Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
x = Shell("C:\Program Files\Microsoft
Office\Office\POWERPNT.EXE")

Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open
Filename:="U\DATA\POWER\Learning.ppt"






.




Bert[_4_]

Running a CommandButton in Excel I get this error
 


Thanks,

I got it to work!!!



-----Original Message-----
Well that presumably means that the file does not exist.

When I tried it with a file that did exits, it worked

fine.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bert" wrote in

message
...
I put in the code as you suggested and I still get Run
Time Error which says the "PowerPoint Can not open the
File" Do you know why this is happening?


-----Original Message-----
Is the code exactly as you show it, as we are getting

wrap around.

Try this alternative

Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open _
Filename:="U\DATA\POWER\Learning.ppt"

I have lost the shell command as it seems totally

superfluous.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the

Purbecks
(remove nothere from the email address if mailing

direct)

"Bert" wrote in

message
...
When I try to open Powerpoint using a commandbutton I

get
a "Run-Time Error". Here's
the Code. Can someone help me with this, Thanks:


Private Sub CommandButton1_Click()
callppt

End Sub

Sub callppt()
x = Shell("C:\Program Files\Microsoft
Office\Office\POWERPNT.EXE")

Dim pptApp As Object
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.Visible = True
pptApp.Presentations.Open
Filename:="U\DATA\POWER\Learning.ppt"






.



.



All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com