If i copy the range on Excel with the Copy method and paste it on the PowerPoint sheet with the PasteSpecial method, the size will be corrected without permission after pasting.
Dim ppApp As New PowerPoint.Application Dim ppPrs As PowerPoint.Presentation 'Open PowerPoint Set ppPrs = ppApp.Presentations.Open ("test.pptx")' 'Copy the specified range on Excel ActiveSheet.Range ("B2: G3"). Copy 'Attach to PowerPoint ppPrs.Slides (1) .Shapes.PasteSpecial DataType: = 0
The height and width can be corrected by specifying the size after pasting, but for some reason only the font size cannot be corrected.
With ppPrs.Slides (1) .Shapes (1) .Width = 100'width .Height = 200'Height .Top = 100'Vertical position .Left = 100'horizontal position .FontSize = 10'Character size End With
With this specification, you can specify the width, height, vertical position, and water position, but you cannot specify the font size.
"The object does not support this method."
Will be displayed.
Is it possible to change the font size of the object pasted with PasteSpecial?
Or is it the wrong way to specify it?
Answer # 1
Shape objects do not have a Font property.
From the TextEffect property, you can get the TextEffectFormat object, and you can change the FontSize etc. there, but it is hard to think that the table is TextFrame etc., so I think that you can also change it with this method.
Regardless of whether it is before or after pasting, it is recommended to adjust the Font as an Excel object.
Answer # 2
This has solved it.
Dim ppApp As New PowerPoint.Application Dim ppPrs As PowerPoint.Presentation Dim TargetTable As Table Dim r As Row, c As Cell, tr As TextRange 'Open PowerPoint Set ppPrs = ppApp.Presentations.Open ("test.pptx")' 'Copy the specified range on Excel ActiveSheet.Range ("B2: G34"). Copy 'Attach to PowerPoint ppPrs.Slides (1) .Shapes.PasteSpecial DataType: = 0 Set TargetTable = ppPrs.Slides (1) .Shapes (1) .Table For Each r In TargetTable.Rows For Each c In r.Cells c.Shape.TextFrame.TextRange.Font.Size = 10'← Set characters here Next Next
- vba [how to remove rows and columns with blanks in the range]
- vba - task table: i want to get the number of statuses for each task priority
- excel vba:i want to color a specific range at a specific cell change event
- access vba you don't want users to see the linked table
- [vba] position error when pasting images
- vba - create linked table at startup
- vba - i want to convert the pivot table to a normal table, extract only the bold text data, and move it to another cell
- an error occurs when pasting the value of the vba pastespecial method
- vba - how to write when changing the data range of a line graph
- about the character decoration in the user form of excel vba
- vba - i want to pick up an arbitrary character string from many text files and list it
- vba:i want to paste a specific range of values into the body of an outlook email
- [access] i want to change the link destination of the link table with vba
- acccess2019 vba sql that combines the table of own file and the table of other access file
- i want to judge whether the table element of the web screen is a tag with vba
- with excel vba, the character in the cell is divided and displayed by line break
- in vba, i want to draw a ruled line once in the cell range summarized in union
- vba - range value is batch-assigned to dynamic array by range error when the number of data is 1 or less
- [access vba] i want to import multi-format text to a table
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- xcode - pod install [!] no `podfile 'found in the project directory