Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
宏从Excel向PowerPoint发送请求:代码在我的计算机上运行,而不是在用户上运行';s计算机_Excel_Vba_Powerpoint - Fatal编程技术网

宏从Excel向PowerPoint发送请求:代码在我的计算机上运行,而不是在用户上运行';s计算机

宏从Excel向PowerPoint发送请求:代码在我的计算机上运行,而不是在用户上运行';s计算机,excel,vba,powerpoint,Excel,Vba,Powerpoint,我的代码从Excel调用PowerPoint,并使用电子表格中的数据创建幻灯片。代码在我的计算机上运行,但用户收到错误1004 我尝试使用其他人以前开发的另一个代码。这个: 由于某些原因,此代码再次在我的计算机上工作,但在用户的计算机上不工作。它在某些选项卡上导致系统错误400,但在1个选项卡上有效 Sub CopyRangeToPresentationTot() 'Step 1: Declare your variables Dim PP As PowerPoint.Application

我的代码从Excel调用PowerPoint,并使用电子表格中的数据创建幻灯片。代码在我的计算机上运行,但用户收到错误1004

我尝试使用其他人以前开发的另一个代码。这个:

由于某些原因,此代码再次在我的计算机上工作,但在用户的计算机上不工作。它在某些选项卡上导致系统错误400,但在1个选项卡上有效

Sub CopyRangeToPresentationTot()
'Step 1: Declare your variables
  Dim PP As PowerPoint.Application
  Dim PPPres As PowerPoint.Presentation
  Dim PPSlide As PowerPoint.Slide
  Dim SlideTitle As String
'Step 2: Open PowerPoint and create new presentation
  Set PP = New PowerPoint.Application
  Set PPPres = PP.Presentations.Add
  PP.Visible = True
'Step 3: Add new slide as slide 1 and set focus to it
  Set PPSlide = PPPres.Slides.Add(1, ppLayoutTitleOnly)
  PPSlide.Select
'Step 4: Copy the range as a picture
  Sheets(ActiveSheet.Name).Range("B2:F18").CopyPicture _
  Appearance:=xlScreen, Format:=xlPicture
'Step 5: Paste the picture and adjust its position
  PPSlide.Shapes.Paste.Select
  PP.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
  PP.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

'Step 7: Memory Cleanup
  PP.Activate
  Set PPSlide = Nothing
  Set PPPres = Nothing
  Set PP = Nothing
End Sub


我希望我的代码将创建一张幻灯片,其中Excel中的范围作为图片。用户遇到了1004错误。

报告错误时,获得错误发生的实际行以及错误消息的文本非常有用。我发现erorr带有范围类的CopyPicture。这是1004错误。您和其他用户是否使用同一版本的excel?该版本是什么?我有最新版本。您认为错误可能是由于MS软件包的旧版本造成的吗?如果我发现最新版本的
CopyPicture
更脆弱,而不是相反。。。