我有一个单词宏启动一个UserForm。
我正在尝试添加一个功能来更新外部excel文档中的某些字段。不幸的是,单词宏不识别许多Excel命令。
以下是这样的想法:
我现在在这里:
Private Sub updateForm_Click()
'Start by parsing the Test Tracking spreadsheet
Set appExcel = CreateObject("Excel.Application")
Dim testTrack_File As Variant
Dim Rng As Range
Dim RowCrnt As Long
testTrack_File = "FileName.exe"
appExcel.Workbooks.Open testTrack_File
'Search Test Tracking spreadsheet for the Vendor
With appExcel.Sheets("Testing_Queue")
'Code Needed here
docField =
End With
appExcel.ActiveWorkbook.Close
appExcel.Quit
Set appExcel = Nothing
End Sub发布于 2014-02-19 23:33:25
当然,您可以在代码中使用Excel函数--可以在with块中使用.Find,如下所示:
With appExcel.Sheets("Testing_Queue")
Dim xlCell As Object
Set xlCell = .Cells.Find("asdf")
'Get the row where the value was found
Dim xlRow As Integer
xlRow = xlCell.Row
'change the target column to whichever you want
Dim xlCol As Integer
xlCol = 6
Dim targetCellValue
targetCellValue = .Cells(xlRow, xlCol).Value
MsgBox (targetCellValue)
End Withhttps://stackoverflow.com/questions/21893792
复制相似问题