Sunday, February 9, 2014

Open a workbook(excel) file on your desktop using vbscript

Sub Button4_Click()
 file_Name = Application.GetOpenFilename() '-- to show the pop up window to find the file  and then it captures the filename of selected file when clicked ok.

' or file_Name= Application.GetOpenFilename(, , Title:="Select the Release module report") '-- to 'show the pop up window(with the text on it) to find the file and open it
set owb=Application.Workbooks.Open(file_Name) '-- it will really open the file. GetOpenFileanme - does not open the file
 MsgBox (file_Name) ' file_Name has full file path

End Sub

No comments:

Post a Comment