Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 24th, 2006, 11:17 AM
Registered User
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Command Button Question

Question from a newbie.

I've created code and debugged it successfully as part of a worksheet object. But when I copied the code to a command button it gives a run-time error. Why can't I simply copy the code from the worksheet to the command button?

It fails at:

and gives the reason as 'Select method of Range class failed.'

Here are the few lines of code before this line:

    ChDir "D:\"
    Workbooks.Open Filename:="D:\Export.csv"
' Activate export.csv
' Modify the contents of the file

Thank you in advance for your help.

Reply With Quote
  #2 (permalink)  
Old September 25th, 2006, 02:36 AM
Friend of Wrox
Join Date: Oct 2003
Location: , , Finland.
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts


Set your code
like this

Reply With Quote
  #3 (permalink)  
Old September 25th, 2006, 08:33 PM
Registered User
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Vemaju; Thank you this helped.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
'Hidden' Command Button David Mulvey Word VBA 0 January 9th, 2007 11:21 PM
navigate b/w worksheets with command button sriramus Access VBA 1 March 26th, 2006 06:40 AM
Command Button False equivalent pinkandthebrain VB.NET 2002/2003 Basics 2 February 2nd, 2004 11:09 PM
Need to open a PDF with a command button RayL Access VBA 2 January 27th, 2004 12:53 PM
command button qry mohiddin52 Access 0 December 22nd, 2003 08:20 AM

All times are GMT -4. The time now is 02:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.