I have a code below:
---------------------------------------
00 Dim filename As String
01 filename = "C:\ExcelVBA\test.xls"
02 Dim sn As Object
03 Set sn = Excel.Application
04 sn.Workbooks.Open filename
05 ' sn.Workbooks(filename).Close
06 Set sn = Nothing
---------------------------------------
Suppose , I want to Dynamic the "file path" given.
And I Modify the code #02 below:
filename =inputbox( "Pls paste a file path to open " , type:=2)
, and then User really paste a path=C:\ExcelVBA\test.xls" , to inputbox window
afterward , I executive the Code #04 as below:
sn.Workbooks.Open filename
then , why doesn't it working properly !?
---------------------------------------
00 Dim filename As String
01 filename = "C:\ExcelVBA\test.xls"
02 Dim sn As Object
03 Set sn = Excel.Application
04 sn.Workbooks.Open filename
05 ' sn.Workbooks(filename).Close
06 Set sn = Nothing
---------------------------------------
Suppose , I want to Dynamic the "file path" given.
And I Modify the code #02 below:
filename =inputbox( "Pls paste a file path to open " , type:=2)
, and then User really paste a path=C:\ExcelVBA\test.xls" , to inputbox window
afterward , I executive the Code #04 as below:
sn.Workbooks.Open filename
then , why doesn't it working properly !?