excel - 在我的计算机中定位文件时,我的单元格的值不会上升
问题描述
我目前正在用 excel 编写宏,但在我的计算机中定位文件时遇到问题。我需要此代码来读取单元格 B7 的值,这将是与此工作簿位于同一文件夹中的文件的名称。我需要它来打开该单元格中的任何文件名。
这是我目前拥有的代码,它不断返回找不到文件“sfile”,因此它没有从单元格中获取值
Dim sfile As String
Dim sLink As String
'Get txt from folder
sfile = Worksheets("Instructions").Cells(7, 2).Value
sLink = Application.ThisWorkbook.Path & "\" & "sfile" & ".txt"
'Copy csv to "Unformatted Log" sheet in this workbook
ssheet = "Unformatted Log"
Application.ScreenUpdating = False
Sheets(ssheet).Cells.ClearContents
Workbooks.Open Filename:=sLink
Windows(sfile).Activate
ActiveSheet.Cells.Copy
wnd.Activate
Sheets("Unformatted Log").Select
Range("A1").Select
Sheets("Unformatted Log").Paste
Application.DisplayAlerts = False
Windows(sfile).Close False
Application.DisplayAlerts = True
Application.ScreenUpdating = True'''
解决方案
推荐阅读
- vba - 1004 错误 - SaveAs 的问题
- yii - 在 Yii2 中将参数从视图传递到布局
- nginx - Nginx、Https、反向代理、握手错误。需要审查“nginx/sites-enabled/default”文件。
- python - 从python中的共享内存字典加载
- validation - cakephp 3 表单验证相关模型数据
- javascript - 如何在 D3 中缩小时按时间尺度对图标进行聚类?
- javascript - Owlcarousel 在 IE Mobile 11 上无法正常工作
- c# - .NET - 使用多个 SqlParameters 将异常记录到 db 并指定每个 db 列中的内容
- asp.net - 避免在 TreeView SelectedNodeChanged 上回发(在 jquery 对话框内)
- python - 有没有办法从轮子上获得相当于冻结点的方法?