[英]Excel VBA- Browse and open the files, paste the open files in macro sheet
我正在嘗試自動化,通過搜索按鈕瀏覽文件並打開文件,它應該粘貼到我的宏表的下一張表中。 請幫助在 excel vba 中做。
我嘗試打開兩個文件,我需要比較這些文件。
此代碼將讓您瀏覽到選定的文件,然后打開它
Sub OpenFile()
Dim strFileToOpen As Variant
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Excel Files *.xls* (*.xls*),")
If strFileToOpen = False Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Workbooks.Open Filename:=strFileToOpen
End If
End Sub
這會讓你開始。 打開后,您可以編寫代碼將工作表復制到您的宏文件中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.