0

我不熟悉 VBA,我需要帮助,我不知道需要多长时间以及我需要做什么,因此将不胜感激。

摘要- 基本上要求 excel 宏循环遍历某些将指定的 excel 工作表并将这些工作表中的数据粘贴到现有的 power point 演示文稿中或创建新的演示文稿并将每个工作表数据作为图片粘贴到个别幻灯片。

关键细节如下:

1 )。每个 Excel 工作表将包含 1 个 Excel 表格或 Excel 图表。

2 )。Excel 表格或图表将在 Excel 中围绕它们设置一个打印区域。这就是 VBA 代码如何知道要在每张纸上复制什么的方式。它需要复制每张纸上设置的打印区域并粘贴到单独的幻灯片中作为图片。

3)。在版本 1 中,它只会创建一个新的 power point 幻灯片并粘贴到单个幻灯片中。我们可以指定高度和宽度要求来确定粘贴到 power point 时图片的大小。在这个版本中,我们可以为粘贴的图片指定一个通用的高度和宽度要求。

4)。代码需要与 Excel 和 PowerPoint 2010 一起使用。我相信 2007 非常相似,为这些版本编写的代码也适用于 2010。

我在这里先向您的帮助表示感谢。:)

4

1 回答 1

1
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
于 2012-10-07T17:42:46.707 回答