作者:乔山办公网日期:
返回目录:excel表格制作
这个应该是用动态位置做的,在公式-名称管理器下,你可以看看;
首先选项连接一个单元格,然后根据不同选择设定不同的区域即可。
'以下代码直接复制进去就行了。
Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub CommandButton1_Click()
Dim Dia1 As Object, Strr As String, PPath As String
Set Dia1 = Application.FileDialog(msoFileDialogFilePicker)
With Dia1
.AllowMultiSelect = False '限制只能同时选择一个文件e799bee5baa6e997aee7ad94e59b9ee7ad94365
.Filters.Clear
.Filters.Add "所有文件", "*.txt", 1 '限制显示的文件类型
.Show
For Each vrtSelectedItem In .SelectedItems
PPath = vrtSelectedItem
Next
End With
Open PPath For Input As #1
Do While Not EOF(1)
Line Input #1, Strr
If Sheet1.Cells(1, 1) <> "" Then
Sheet1.Cells(1, 1) = Sheet1.Cells(1, 1) & Chr(10) & Strr
Else
Sheet1.Cells(1, 1) = Sheet1.Cells(1, 1) & Strr
End If
Loop
Close #1
End Sub
怎么觉得你这功能就是切片器的功能
或者通过录制宏来实现。