Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to copy and paste cell into text box in PowerPoint

Hi there, hope someone can help.
I'm writing a simple Macro to copy the text in a cell (the result of a
formula) into a Text Box in a specific PowerPoint slide. What I have so far
is shown below (I have named the text box in Powerpoint 'textbox1'). I'm
struggling to find a way of pasting though!
Can anyone help?

Thanks,
Andy
UK


Sub macInsertStatsFigures()

'Jump to the Exit Criteria worksheet
Worksheets("Stats 11").Activate

Dim strFindText As String
Dim strReplaceText As String

strReplaceText = Range("P7")

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

'Select the correct slide in the Presentation
PPApp.ActivePresentation.Slides(4).Select

'Select Textbox1 in powerpoint
PPApp.ActiveWindow.Selection.SlideRange.Shapes("te xtbox1").Select

'Paste the contents of strReplaceText into it




End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro to copy and paste cell into text box in PowerPoint

Make sure the text box name is correct.....(with or without spaces)

ActiveWindow.Selection.SlideRange.Shapes("Text Box 1").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText
--
If this post helps click Yes
---------------
Jacob Skaria


"Andy C Matthews" wrote:

Hi there, hope someone can help.
I'm writing a simple Macro to copy the text in a cell (the result of a
formula) into a Text Box in a specific PowerPoint slide. What I have so far
is shown below (I have named the text box in Powerpoint 'textbox1'). I'm
struggling to find a way of pasting though!
Can anyone help?

Thanks,
Andy
UK


Sub macInsertStatsFigures()

'Jump to the Exit Criteria worksheet
Worksheets("Stats 11").Activate

Dim strFindText As String
Dim strReplaceText As String

strReplaceText = Range("P7")

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

'Select the correct slide in the Presentation
PPApp.ActivePresentation.Slides(4).Select

'Select Textbox1 in powerpoint
PPApp.ActiveWindow.Selection.SlideRange.Shapes("te xtbox1").Select

'Paste the contents of strReplaceText into it




End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to copy and paste cell into text box in PowerPoint

Thank you kindly for your help Jacob.
The name of the text box is definitley correct.
I have tried adding the lines you suggested, however the debugger stops on
the second line with 'Object Doesn't support this property or method'

I am using Excel and PowerPoint 2003.

--Andy

"Jacob Skaria" wrote:

Make sure the text box name is correct.....(with or without spaces)

ActiveWindow.Selection.SlideRange.Shapes("Text Box 1").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText
--
If this post helps click Yes
---------------
Jacob Skaria


"Andy C Matthews" wrote:

Hi there, hope someone can help.
I'm writing a simple Macro to copy the text in a cell (the result of a
formula) into a Text Box in a specific PowerPoint slide. What I have so far
is shown below (I have named the text box in Powerpoint 'textbox1'). I'm
struggling to find a way of pasting though!
Can anyone help?

Thanks,
Andy
UK


Sub macInsertStatsFigures()

'Jump to the Exit Criteria worksheet
Worksheets("Stats 11").Activate

Dim strFindText As String
Dim strReplaceText As String

strReplaceText = Range("P7")

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

'Select the correct slide in the Presentation
PPApp.ActivePresentation.Slides(4).Select

'Select Textbox1 in powerpoint
PPApp.ActiveWindow.Selection.SlideRange.Shapes("te xtbox1").Select

'Paste the contents of strReplaceText into it




End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to copy and paste cell into text box in PowerPoint

Apologies! Forgot to add "PPApp." at the start of each of those statements.
It's working now - thank you so much!

"Andy C Matthews" wrote:

Thank you kindly for your help Jacob.
The name of the text box is definitley correct.
I have tried adding the lines you suggested, however the debugger stops on
the second line with 'Object Doesn't support this property or method'

I am using Excel and PowerPoint 2003.

--Andy

"Jacob Skaria" wrote:

Make sure the text box name is correct.....(with or without spaces)

ActiveWindow.Selection.SlideRange.Shapes("Text Box 1").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText
--
If this post helps click Yes
---------------
Jacob Skaria


"Andy C Matthews" wrote:

Hi there, hope someone can help.
I'm writing a simple Macro to copy the text in a cell (the result of a
formula) into a Text Box in a specific PowerPoint slide. What I have so far
is shown below (I have named the text box in Powerpoint 'textbox1'). I'm
struggling to find a way of pasting though!
Can anyone help?

Thanks,
Andy
UK


Sub macInsertStatsFigures()

'Jump to the Exit Criteria worksheet
Worksheets("Stats 11").Activate

Dim strFindText As String
Dim strReplaceText As String

strReplaceText = Range("P7")

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

'Select the correct slide in the Presentation
PPApp.ActivePresentation.Slides(4).Select

'Select Textbox1 in powerpoint
PPApp.ActiveWindow.Selection.SlideRange.Shapes("te xtbox1").Select

'Paste the contents of strReplaceText into it




End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro to copy and paste cell into text box in PowerPoint

Try using the index instead. I have tried this from a excel macro and this
works for me..

Set PPSlide = PPApp.ActivePresentation.Slides(4)
PPSlide.Shapes(1).Select
PPApp.ActiveWindow.Selection.TextRange.Text = strReplaceText

If this post helps click Yes
---------------
Jacob Skaria


"Andy C Matthews" wrote:

Thank you kindly for your help Jacob.
The name of the text box is definitley correct.
I have tried adding the lines you suggested, however the debugger stops on
the second line with 'Object Doesn't support this property or method'

I am using Excel and PowerPoint 2003.

--Andy

"Jacob Skaria" wrote:

Make sure the text box name is correct.....(with or without spaces)

ActiveWindow.Selection.SlideRange.Shapes("Text Box 1").Select
ActiveWindow.Selection.TextRange.Text = strReplaceText
--
If this post helps click Yes
---------------
Jacob Skaria


"Andy C Matthews" wrote:

Hi there, hope someone can help.
I'm writing a simple Macro to copy the text in a cell (the result of a
formula) into a Text Box in a specific PowerPoint slide. What I have so far
is shown below (I have named the text box in Powerpoint 'textbox1'). I'm
struggling to find a way of pasting though!
Can anyone help?

Thanks,
Andy
UK


Sub macInsertStatsFigures()

'Jump to the Exit Criteria worksheet
Worksheets("Stats 11").Activate

Dim strFindText As String
Dim strReplaceText As String

strReplaceText = Range("P7")

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Reference existing instance of PowerPoint
Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide

'Select the correct slide in the Presentation
PPApp.ActivePresentation.Slides(4).Select

'Select Textbox1 in powerpoint
PPApp.ActiveWindow.Selection.SlideRange.Shapes("te xtbox1").Select

'Paste the contents of strReplaceText into it




End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Excel & Powerpoint Copy & paste Tigerxxx Excel Discussion (Misc queries) 0 July 14th 08 03:16 PM
How do I copy and paste a powerpoint slide from excel using vba co LilacSpokane Excel Programming 4 February 28th 08 10:04 PM
Excel to Powerpoint - copy/paste text box AussieDave Excel Programming 0 December 5th 07 05:45 AM
copy table or graph and paste into powerpoint funkymonkUK[_15_] Excel Programming 1 May 27th 05 05:30 PM
Copy and Paste from Excel to powerpoint the pix is Truncated Alicia Excel Discussion (Misc queries) 0 March 4th 05 02:47 AM


All times are GMT +1. The time now is 07:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"