如果通过EWA api在页面中嵌入一个驱动器的Excel表格。 (微软' s)通常,这段代码有效:
Dim Desktop As String
Dim FileName As String
Desktop = CreateObject("Wscript.Shell").Specialfolders("Desktop")
With ActiveSheet
FileName = Desktop & Application.PathSeparator & .Range("B1").Value
.Range("H2:K33").Copy
Workbooks.Add
ActiveWorkbook.Sheets(1).Range("A1").PasteSpecial xlPasteValues
Application.CutCopyMode = False
End With
With ActiveWorkbook
.SaveAs FileName:=FileName _
, FileFormat:=xlTextMSDOS, CreateBackup:=False
.Close SaveChanges:=False
End With
Dim fs As Object
Dim f As Object
Dim content As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(FileName & ".txt", 1, -2)
content = f.readall
f.Close
content = Replace(content, Chr(34) & "<", "<")
content = Replace(content, ">" & Chr(34), ">")
content = Replace(content, Chr(34) & Chr(34), Chr(34))
Set f = fs.createTextFile(FileName & ".txt", True, False)
f.write (content)
f.Close
Set f = Nothing
Set fs = Nothing
即。 &#34;片材&#34;将参考实际工作表,我可以在这里提出请求,例如&#34; sheet.getRange(...)&#34;
当我们关闭标签/工作表时会出现问题。即&#34; Sheet1&#34;,&#34; Sheet2&#34;等不会按预期显示。问题是&#34;表&#34;一片空白。即工作表是可见/可用的,但&#34; workbook.getActiveSheet()&#34;返回null。
如何获取活动表?
答案 0 :(得分:0)
解决方案:只需使用您希望在EWA工作簿上找到的相同命令。