Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

New object/automation error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephen - 26 Jan 2006 00:02 GMT
I need to create a new sheet in my macro.  So far the code I've been using
looks something like this:

Dim sheet7 as worksheet
sheet7 = new worksheet

But I keep getting error saying that the object doesn't support automation.  
I'm still a new programmer and I'm not sure what automation is.  I can't seem
to find any documentation to tell me what I'm doing wrong.
Norman Jones - 26 Jan 2006 00:09 GMT
Hi Stephen,

Try:

Dim SH As Worksheet

Set SH = Worksheets.Add

---
Regards,
Norman

>I need to create a new sheet in my macro.  So far the code I've been using
> looks something like this:
[quoted text clipped - 7 lines]
> seem
> to find any documentation to tell me what I'm doing wrong.
Jim Thomlinson - 26 Jan 2006 00:11 GMT
When objects are created or referenced you need the set statement.

   Dim wksNew As Worksheet
   
   Set wksNew = Worksheets.Add

Don't use Sheet7 as your variable as Excel uses Sheet1, Sheet2, ... as it's
default names when new sheets are created and you could run into some
difficulties.
Signature

HTH...

Jim Thomlinson

> I need to create a new sheet in my macro.  So far the code I've been using
> looks something like this:
[quoted text clipped - 5 lines]
> I'm still a new programmer and I'm not sure what automation is.  I can't seem
> to find any documentation to tell me what I'm doing wrong.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.