Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2006
    Posts
    2

    problem setting Excel sheet name in vba from a form

    Hi



    I would appreciate some help with vba from access please. The following code works fine:

    set objSheet = ObjExcel.Sheets("5TH 2004")

    However, I want the user to provide the sheet name from a form. I have tried all sorts of variations using the form field name me.frmSheet such as

    set objSheet = ObjExcel.Sheets("me.frmSheet") but no joy.

    Please can anyone help me?

    Sue (fairly new to VBA)

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Sue,

    Try something like:

    Code:
    set objSheet = ObjExcel.Sheets(Forms!frmSheet!NameOfTextBox)
    Be advised that the form must be open when the code executes, or you will get an error.

  3. #3
    Join Date
    Apr 2006
    Posts
    2
    Hi Patrick

    Thanks but I am afraid that does not work. I get a type mismatch (error 13).

    Sue

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Setting a field to be dependent on another
    By CushingMT in forum Forms
    Replies: 0
    Last Post: 11-19-2008, 11:51 AM
  2. Replies: 0
    Last Post: 02-21-2008, 09:52 AM
  3. Importing Excel Sheet into Access dbase
    By tonystowe in forum Import/Export Data
    Replies: 0
    Last Post: 12-08-2006, 11:35 AM
  4. link excel form to access table
    By data123 in forum Import/Export Data
    Replies: 6
    Last Post: 06-23-2006, 10:17 AM
  5. Setting combo box properties
    By rathfam4 in forum Programming
    Replies: 1
    Last Post: 12-28-2005, 02:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums