Dear Amar, Use below code with little bit correction in red color.... This code has been modify as per Krish's solution.
Hope it will help to you See attached sheet... Dim IFileName As Variant Dim SFileName As Variant Public Sub Lfile_Name() IFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls") MsgBox IFileName End Sub Public Sub SFile_Name() SFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls") MsgBox SFileName End Sub Public Sub StartButton_Click() On Error Resume Next Call Lfile_Name Workbooks.Open IFileName Call SFile_Name Workbooks.Open SFileName End Sub On Wed, Feb 8, 2012 at 2:11 PM, NOORAIN ANSARI <noorain.ans...@gmail.com>wrote: > Dear Amarender, > > Please use it.. > > Public Sub Lfile_Name() > Dim IFileName As Variant > IFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls") > MsgBox IFileName > End Sub > Public Sub SFile_Name() > Dim SFileName As Variant > SFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls") > MsgBox SFileName > End Sub > > Public Sub StartButton_Click() > On Error Resume Next > Call Lfile_Name > Workbooks.Open IFileName > Call SFile_Name > Workbooks.Open SFileName > End Sub > > > On Wed, Feb 8, 2012 at 1:49 PM, Kasireddy Amarender < > kassi.re...@gmail.com> wrote: > >> Hi Team, >> >> I would like to know if I can use the value of one procedure as input >> to the other procedure. >> >> For example: >> >> I have a user form, it has two command buttons, the first one is >> requesting for a file location(address/path) and the second does also >> requesting another file location (address/path). >> >> And in my next procedure I would like to open the file which is stored >> in my first command button, similarly would like to open second >> command buttion file. >> >> Here is the code I have... >> >> Public Sub IButton_Click() >> >> Dim IFileName As Variant >> IFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls") >> >> MsgBox IFileName >> >> End Sub >> >> Public Sub IIButton_Click() >> >> Dim SFileName As Variant >> SFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls") >> MsgBox SFileName >> >> End Sub >> >> >> Public Sub StartButton_Click() >> >> Workbooks.Open IFileName >> Workbooks.Open SFileName >> >> End Sub >> >> Thanks in advance. >> >> Best regards, >> Amar >> >> -- >> FORUM RULES (986+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >> 5) Cross-promotion of, or links to, forums competitive to this forum in >> signatures are prohibited. >> >> NOTE : Don't ever post personal or confidential data in a workbook. >> Forum owners and members are not responsible for any loss. >> >> >> ------------------------------------------------------------------------------------------------------ >> To post to this group, send email to excel-macros@googlegroups.com >> > > > > -- > Thanks & regards, > Noorain Ansari > *http://noorainansari.com/* <http://excelmacroworld.blogspot.com/> > *http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/> > > > -- Thanks & regards, Noorain Ansari *http://noorainansari.com/* <http://excelmacroworld.blogspot.com/> *http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/> -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com
Sample_Workbook(Amar).xlsm
Description: Binary data