Consulting

Results 1 to 4 of 4

Thread: Using a closed Workbook file

  1. #1
    VBAX Regular
    Joined
    Aug 2005
    Posts
    79
    Location

    Using a closed Workbook file

    With my Userform, I want to be able to read and write information from a workbook. I don't want the user of the UserForm to see the workbook. Can you do this with a closed workbook and how do you lock it so no one else has access to the workbook? Or is it better and faster to open the workbook but keep it hiden (if you can do that)?

    What kind of code do I use to do this. Suggestions / Questions

    Thanks

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Probably the best way would be to open the workbook, get the text, and close the workbook. You can use Application.ScreenUpdating = False to stop the user from seeing what you are doing.

    So you can just open the workbook.

    Set Wkb = Workbooks.Open(FileName:=...
    MyText = Wkb.Sheets("Sheet1").Range("A1").Text
    Wkb.Close SaveChanges:=False

  3. #3
    VBAX Regular
    Joined
    Aug 2005
    Posts
    79
    Location
    I have to think about what you suggested but thanks for the input

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Ok, this method would also allow for the other workbook to be password protected so user's could not open it themselves.

Posting Permissions

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