Hi,
I saw the below coding from youtube. Anyone can help me to understand what is the different between "Dim" & "Set"?
Are we able copy the table in editor format?
Thank you.
Sub CopyPicture()
Dim mypicture As PowerPoint.Application
Set mypicture = New PowerPoint.Application
mypicture.Visible = msoTrue
Dim mypicture_pres As PowerPoint.Presentation
Set mypicture_pres = mypicture.Presentations.Add
Dim mypicture_slide As PowerPoint.Slide
Set mypicture_slide = mypicture_pres.Slides.Add(1, ppLayoutBlank)
Dim mychart As ChartObject
Range("B2:G12").Select
Selection.Copy
mypicture_slide.Shapes.PasteSpecial ppPasteBitmap
End Sub
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
Hi,
Dim is used for declaring the object name and type, "Set" is to assign a value to it.
Set is used for objects only, not for all variables, for example:
Dim Rw as Long
Rw=54
What you have in that file is not a table, it's a colored range of cells that looks like a table.
Instead of pasting as image, try this:
mypicture_slide.Shapes.PasteSpecial DataType:=ppPasteOLEObject, Link:=msoFalse
You can double click on it to edit.
Thank you Catalin. With this editable coding, does it link to the original source file or mainly the table copy over to pptx?
I am not an expert in macro, still at learning stage. However, I am curious are we able to track how fast macro is running when we execute the coding/program? My manager always asked me to reduce my cycle time to process a report. I wonder how to show her the timing / speed when a macro run? Do you have any idea?
Thank you.
Power Query
Power Pivot
Xtreme Pivot Tables
Excel for Decision Making
Excel for Finance
Excel Analysis Toolpak
Power BI
Excel
Word
Outlook
Excel Expert
Excel Customer Service
PowerPoint
November 8, 2013
As you can see, the line I sent has this: Link:=msoFalse
You can change it to true if you want to keep the link to original object.
At the beginning of your code:
Dim StartTime as double
StartTime=Now()
At the end of your code:
Msgbox "Elapsed time: " & Format((Now()-StartTime)/24/60/60,"hh:mm:ss")
Answers Post
1 Guest(s)