Results 1 to 2 of 2

Thread: VB for excel

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Argentina, Buenos Aires
    Posts
    38

    VB for excel

    I am using VB for Excel. I wrote a program (code) with no problems except this: I want to open an excel workbook whose name I want to introduce as data, for it changes each time I use the program. I tried various alternatives, but all failed.

  2. #2
    Lively Member TheFIDDLER's Avatar
    Join Date
    May 2002
    Location
    here and there and far away
    Posts
    126
    Does this help?

    VB Code:
    1. Dim stFileName as string
    2. stfilename = (reference a cell, or reference your filename)
    3. Workbooks.Open FileName:=stFileName

    Depending on how you store your file name, you might have to build up your path string with something like:
    stfilename = "c:\" & stfilename & ".xls"


    If not, post what you have and we'll take a look at it.
    -----
    #VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP

    I miss my VIC 20.
    Never should have upgraded to my commodore 64. ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width