Construct a xls file name and open/activate it

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grntrnr
    New Member
    • Mar 2010
    • 1

    Construct a xls file name and open/activate it

    I am not able to construct a workbook file name as a string and use it to activate a workbook.

    Option Private Module
    Public wbVersion As String
    Public sFilePath As String
    Public wbCntl As Workbook
    Public wbFilename as String

    Sub SetConstantVari ables()
    wbVersion = " v12.xls"
    sFilePath = "I:\Documen ts and Settings\Grant\ My Documents\Neuro Fission\Develop ment\"
    wbFilename = sFilePath + "Control" + wbVersion
    wbFilename.Acti vate
    or
    Workbooks(wbFil ename).Activate
    etc
    .
    .

    Apparently, none of the methods for activating the workbook works for me, using a predefined string name for the workbook. Can this be done? What might I be doing wrong?
    Grant
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    perhaps if you open it first:

    Workbooks.open( wbfilename)

    then activate it.

    Comment

    Working...