English 中文(简体)
尝试将文件导出为PDF,但出现错误未找到命名参数
原标题:Tried to export file as PDF but had error Named argument not found

我试图将excel宏中的word文档导出为PDF,但当我尝试运行宏时,会弹出错误“未找到命名参数”并突出显示“Type:=”,我不知道是否需要添加引用或其他内容,我缺少什么?

Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim wdCell As Word.cell

With wdDoc
        saveLocation = "https://orgindustrie-my.sharepoint.com/personal/different_person_org_com/Documents/folder/subfolder"
        .ExportAsFixedFormat Type:=xlTypePDF, _
             Filename:=saveLocation & "/" & "File" & Range("G1").Value & ".pdf"
        .Save
        .Close
End With

我对vba还很陌生,所以我不知道自己做错了什么。非常感谢你的帮助。

最佳回答

您正在合并Excel方法工作簿。ExportAsFixedFormat和Word方法文档。ExportAsFixedFormat

Word:

Parameters

Name Required/Optional Data Type Description
OutputFileName Required String The path and file name of the new PDF or XPS file.
ExportFormat Required WdExportFormat Specifies either PDF or XPS format.

因此:

    .ExportAsFixedFormat ExportFormat:=wdExportFormatPDF, _
        OutputFileName:=saveLocation & "/" & "File" & Range("G1").Value & ".pdf"
问题回答

暂无回答




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签