保存为PDF添加空白页

我正在尝试创建一个宏,以允许最终用户单击一个宏,该宏将要求他们提供要添加为新页面的PDF文件。该页面基于模板,并且在图像中心有一个合并的单元格。我能够创建新页面以及打开带有特定过滤器的文件资源管理器窗口,但是对此我有几个问题。

  1. 是否可以从文件资源管理器中获取完整的文件路径,并将其放入变量中,以供以后在PDF插入期间使用(因为我的最终用户可能将PDF保存在不同的目录中)?

问题代码:


    With fd

        .AllowMultiSelect = False

        ' Set the title of the dialog box.
        .Title = "Please select the file."

        ' Clear out the current filters
        .Filters.Clear
        .Filters.Add "PDF Files","*.PDF"
        .Filters.Add "All Files","*.*"

        ' Show the dialog box. If the .Show method returns True,the
        ' user picked at least one file. If the .Show method returns
        ' False,the user clicked Cancel.
        If .Show = True Then
            txtFileName = .SelectedItems(1) 'txtFileName will return the file

        End If
    End With
  1. 是否可以将PDF图像插入Excel单元格并使其适合单元格尺寸?

问题代码:

tempRow = lastRow + 9
   'Sets the correct row/column
    Set rng = crrntWorkbook.Sheets(1).Range("B" & tempRow)
   'This portion is trying to insert the PDF as an OLEObject picture
    crrntWorkbook.Sheets(1).Range("B" & tempRow) = crrntWorkbook.Sheets(1).OLEObjects.Add(Filename:=txtFileName,_
    DisplayAsIcon:=False).activate

在这些问题上的任何帮助将不胜感激!

rabbitcf 回答:保存为PDF添加空白页

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3163810.html

大家都在问