Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-17-2006, 01:29 PM
Novice
 
Join Date: Apr 2006
Posts: 2
dataman
Default 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)
Reply With Quote
  #2  
Old 04-18-2006, 04:59 AM
Expert
 
Join Date: Dec 2005
Location: Wilmington, DE - USA
Posts: 275
matthewspatrick
Send a message via MSN to matthewspatrick
Default

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.
Reply With Quote
  #3  
Old 04-18-2006, 05:26 AM
Novice
 
Join Date: Apr 2006
Posts: 2
dataman
Default

Hi Patrick

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

Sue
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a field to be dependent on another CushingMT Forms 0 11-19-2008 08:51 AM
how do I place date of linked excel sheet in a form meatgrande Access 0 02-21-2008 06:52 AM
Importing Excel Sheet into Access dbase tonystowe Import/Export Data 0 12-08-2006 08:35 AM
link excel form to access table data123 Import/Export Data 6 06-23-2006 08:17 AM
Setting combo box properties rathfam4 Programming 1 12-27-2005 11:27 PM


All times are GMT -8. The time now is 08:24 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.