[英]Requirement for an Excel Macro to copy data from excel into power point using VBA
I'm not familiar with VBA and I needed help with this, I don't know how long it would take and what I need to do so any help would be appreciated. 我对VBA并不熟悉,因此我需要帮助,我不知道需要多长时间以及我需要做什么,因此我们将不胜感激。
Summary - Basically requirement for an excel macro to loop through certain excel sheets which would be specified and paste the data from each of these sheets into either an existing power point presentation or create a new presentation and paste each of the sheet data as picture on an individual slide. 总结 -基本要求一个excel宏循环通过将要指定的某些excel工作表,并将这些工作表中的每个工作表中的数据粘贴到现有的Powerpoint演示文稿中,或者创建一个新的演示文稿并将每个工作表数据作为图片粘贴到个人幻灯片。
Key Details are as follows: 关键细节如下:
1 ). 1 )。 Each Excel worksheet would either contain 1 excel table or Excel chart. 每个Excel工作表将包含1个excel表或Excel图表。
2 ). 2 )。 The Excel table or chart will have a print area set around them in Excel. Excel表格或图表在Excel中将在其周围设置一个打印区域。 This is how the VBA code will know what to copy on each sheet. 这就是VBA代码知道每张纸上要复印的内容的方式。 It needs to copy the set print area on each sheet and paste in a separate power point slide as picture. 它需要在每张纸上复制设置的打印区域,然后粘贴在单独的幻灯片中作为图片。
3 ). 3 )。 In version 1 it will just create a new power point slide and paste into an individual slides. 在版本1中,它将仅创建一个新的PowerPoint幻灯片并将其粘贴到单个幻灯片中。 We can specify the height and width requirements to determine the size of picture when pasted into power point. 我们可以指定高度和宽度要求,以确定粘贴到Power Point中的图片大小。 In this version we can specify a generic height and width requirement for the pasted picture. 在此版本中,我们可以为粘贴的图片指定通用的高度和宽度要求。
4 ). 4 )。 Code needs to work with Excel and PowerPoint 2010. I believe 2007 is very similar and the code written for those versions would work on 2010 also. 代码需要与Excel和PowerPoint 2010配合使用。我相信2007年非常相似,并且为这些版本编写的代码也可以在2010年使用。
Thanks for the help in advance. 我在这里先向您的帮助表示感谢。 :) :)
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.