mooseman
01-09-2017, 08:47 AM
For Office 2016 on Windows7
I have this code that updates the data in a standard embedded excel object (not a chart) and when the code runs the object shows the change, but if I save the file then open it and double click the object to activate it, the data all disappears. If I run some code to activate (double click) then the data is "saved"
Does anyone else have this problem or know what is wrong?
Is there something else I need to do to the with code block that updates the embedded object?
Sub Slide_16(xlWorkBook, company, lDate) ' I bring in the workbook object and two text variables
For Each oSH In ActivePresentation.Slides(16).Shapes
Select Case oSH.Name 'find the objects by the name I have given them
Case "Top_Item_16"
lrow = xlWorkBook.Worksheets(21).Range("B1").CurrentRegion.Rows.Count 'just finds last row of data
oSH.Chart.ChartTitle.Text = company & Chr(10) & "STop products" & Chr(10) & "26 Weeks Ending " & lDate
With oSH.Chart.ChartData
'this updates the values in the datasheet
.Workbook.sheets(1).Range("E1:H" & lrow).Value = xlWorkBook.sheets(21).Range("A1:D" & lrow).Value
End With
Case "Footer"
message = "Source:database- " & company & " " & lDate & " Confidential"
oSH.TextFrame.WordWrap = msoFalse
oSH.TextFrame.AutoSize = ppAutoSizeShapeToFitText
oSH.TextFrame.TextRange.Text = message
End Select
Next oSH
End Sub
I have this code that updates the data in a standard embedded excel object (not a chart) and when the code runs the object shows the change, but if I save the file then open it and double click the object to activate it, the data all disappears. If I run some code to activate (double click) then the data is "saved"
Does anyone else have this problem or know what is wrong?
Is there something else I need to do to the with code block that updates the embedded object?
Sub Slide_16(xlWorkBook, company, lDate) ' I bring in the workbook object and two text variables
For Each oSH In ActivePresentation.Slides(16).Shapes
Select Case oSH.Name 'find the objects by the name I have given them
Case "Top_Item_16"
lrow = xlWorkBook.Worksheets(21).Range("B1").CurrentRegion.Rows.Count 'just finds last row of data
oSH.Chart.ChartTitle.Text = company & Chr(10) & "STop products" & Chr(10) & "26 Weeks Ending " & lDate
With oSH.Chart.ChartData
'this updates the values in the datasheet
.Workbook.sheets(1).Range("E1:H" & lrow).Value = xlWorkBook.sheets(21).Range("A1:D" & lrow).Value
End With
Case "Footer"
message = "Source:database- " & company & " " & lDate & " Confidential"
oSH.TextFrame.WordWrap = msoFalse
oSH.TextFrame.AutoSize = ppAutoSizeShapeToFitText
oSH.TextFrame.TextRange.Text = message
End Select
Next oSH
End Sub