English 中文(简体)
使用申请。 当工作月名称包含空间时,在Excel VBA进行操作。
原标题:Using Application.Run in Excel VBA when workbook name contains spaces
  • 时间:2010-01-26 00:27:32
  •  标签:
  • vba
  • excel
Application.Run "MyWorkBook.xls!Macro1"

将在<代码>MyWorkBook.xl文档中操作(由宏观称为Macro1)。

Application.Run "My Work Book.xls!Macro1"

如果工作名称包含空间,Excel说“无法找到宏观”。

我刚刚花了几个小时,表明它占据了造成这一问题的空间......

www.un.org/Depts/DGACM/index_spanish.htm 如果不重新命名档案,是否有办法?

最佳回答

2. 围绕档案名称使用单一字句:

Application.Run " My Work Book.xls !Macro1"
问题回答

将每个空间改为<代码>%20

Application.Run "My%20Work%20Book.xls!Macro1"

这里File_name是你想要称之为你的宏观档案的名称。

  • Application.run " "+File_name+" "+"!Macro"
  • Single quote in between double quote followed by + File_name + single quote in between double quote + your macro name in between double quotes.




相关问题
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 ...

热门标签