从 VBA 打开 .btw 文件
Open .btw file from VBA
我想打开 .btw
格式的文件。
这是我的代码。
Sub Printlabel()
Dim printdata As Workbook
Dim history As Workbook
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btSubString As BarTender.SubString
Set btApp = New BarTender.Application
Set btFormat = btApp.Formats.Open("D:\test\test.btw")
btApp.Visible = False
btFormat.SetNamedSubStringValue "Part", Filename
'Select the data source
btSubString = btFormat.NamedSubStrings.GetSubString(1)
'Show the data source's name
MessageBox.Show (btSubString.Name)
End Sub
我得到的错误:
Compile Error:
User-defined type not defined
您必须设置对 BarTender 库的引用。
因此,在 VBA Editor 菜单中转到 Tools › References 并浏览 BarTender Library。
有关详细信息,请参阅:Check or Add an Object Library Reference
我想打开 .btw
格式的文件。
这是我的代码。
Sub Printlabel()
Dim printdata As Workbook
Dim history As Workbook
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btSubString As BarTender.SubString
Set btApp = New BarTender.Application
Set btFormat = btApp.Formats.Open("D:\test\test.btw")
btApp.Visible = False
btFormat.SetNamedSubStringValue "Part", Filename
'Select the data source
btSubString = btFormat.NamedSubStrings.GetSubString(1)
'Show the data source's name
MessageBox.Show (btSubString.Name)
End Sub
我得到的错误:
Compile Error:
User-defined type not defined
您必须设置对 BarTender 库的引用。
因此,在 VBA Editor 菜单中转到 Tools › References 并浏览 BarTender Library。
有关详细信息,请参阅:Check or Add an Object Library Reference