首页 文章

要求Excel宏使用VBA将数据从Excel复制到电源点

提问于
浏览
0

我不熟悉VBA,我需要帮助,我不知道需要多长时间,我需要做什么,所以任何帮助将不胜感激 .

Summary - 基本上要求excel宏循环浏览某些excel表格,这些表格将被指定并将每张表格中的数据粘贴到现有的功率点演示文稿中或创建新的演示文稿并将每个工作表数据粘贴为图片上的个人幻灯片 .

关键详情如下:

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

2 ) . Excel表格或图表将在Excel中围绕它们设置打印区域 . 这就是VBA代码将如何知道每张表上要复制的内容 . 它需要复制每张纸上的设置打印区域并粘贴在单独的电源点幻灯片中作为图片 .

3 ) . 在版本1中,它将创建一个新的功率点幻灯片并粘贴到单个幻灯片中 . 我们可以指定高度和宽度要求,以确定粘贴到功率点时图片的大小 . 在此版本中,我们可以为粘贴的图片指定通用的高度和宽度要求 .

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

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

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
    

相关问题