[英]Requirement for an Excel Macro to copy data from excel into power point using VBA
我对VBA并不熟悉,因此我需要帮助,我不知道需要多长时间以及我需要做什么,因此我们将不胜感激。
总结 -基本要求一个excel宏循环通过将要指定的某些excel工作表,并将这些工作表中的每个工作表中的数据粘贴到现有的Powerpoint演示文稿中,或者创建一个新的演示文稿并将每个工作表数据作为图片粘贴到个人幻灯片。
关键细节如下:
1 )。 每个Excel工作表将包含1个excel表或Excel图表。
2 )。 Excel表格或图表在Excel中将在其周围设置一个打印区域。 这就是VBA代码知道每张纸上要复印的内容的方式。 它需要在每张纸上复制设置的打印区域,然后粘贴在单独的幻灯片中作为图片。
3 )。 在版本1中,它将仅创建一个新的PowerPoint幻灯片并将其粘贴到单个幻灯片中。 我们可以指定高度和宽度要求,以确定粘贴到Power Point中的图片大小。 在此版本中,我们可以为粘贴的图片指定通用的高度和宽度要求。
4 )。 代码需要与Excel和PowerPoint 2010配合使用。我相信2007年非常相似,并且为这些版本编写的代码也可以在2010年使用。
我在这里先向您的帮助表示感谢。 :)
Option Compare Database
Private Sub Command3_Click()
Call findField(Text1.Value)
End Sub
Public Function findField(p_myFieldName)
Dim db As Database, _
tb As TableDef, _
fd As Field
Set db = CurrentDb
''''''Clearing the contents of the table
DoCmd.RunSQL " Delete from Field_Match_Found"
For Each tb In db.TableDefs
For Each fd In tb.Fields
If fd.Name = p_myFieldName Then
'MsgBox ("Table " & tb.Name & " has the field " & fd.Name)
strsql = "INSERT INTO Field_Match_Found Values (""" & tb.Name & """, """ & fd.Name & """)"
DoCmd.RunSQL strsql
End If
Next fd
Next tb
Set fd = Nothing
Set tb = Nothing
Set db = Nothing
''''''''Checking if any match found for the specified field or not
If DCount("Table_name", "Field_Match_Found") = 0 Then
MsgBox ("No match found in your database")
Else
MsgBox ("Check Table Field_Match_Found for your output")
End If
'''''''''''clearing the text box for the next time
Me.Text1.Value = ""
End Function
Private Sub Form_Load()
Me.Text1.Value = ""
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.