We help IT Professionals succeed at work.

Excel to PPT textbox problem

creativefusion
on
Medium Priority
345 Views
Last Modified: 2012-05-12
All,

In excel, I have a textbox called textbox3.

In ppt, I have a textbox called TxtFootnote.

In vba, I am trying to populate TxtFootnote in ppt with the text from textbox3 but it keeps failing.

Can someone help me with this as it is doing my head in?

CF
Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes("TxtFootnote")
oPPTShape.TextFrame.TextRange = ActiveSheet.TextBox3.Text

Open in new window

Comment
Watch Question

Various
CERTIFIED EXPERT
Commented:
use the following, update path of workbook, sheet name and textbox name as appropriate;


Dim xlApp As Object
    Dim xlWB As Object
    Set xlApp = CreateObject("Excel.Application")
    
    
    xlApp.Visible = True
    Set xlWB = xlApp.Workbooks.Open("D:\Documents and Settings\e331982\Desktop\Book1.xlsm", , False)
        
    Dim ws As Object
    Set ws = xlWB.worksheets("Sheet1")
    
    Dim textval As String
    textval = ws.textbox3.Text
    
    Set ws = Nothing
    Set xlWB = Nothing
    Set xlApp = Nothing
    
    
    Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes("TxtFootnote")
    oPPTShape.TextFrame.TextRange = textval

Open in new window

Author

Commented:
Excellent help. Thanks

Explore More ContentExplore courses, solutions, and other research materials related to this topic.