Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 8
Default add-in problems

I am trying to copy a worksheet from my add-in to the new workbook when
excel opens. I have activated the add-in, but everytime I open Excel,
I get "Object variable or WIth variable not set".
Here is my code

Private Sub Workbook_Open()
Workbooks("Test.xla").Worksheets(1).Copy
after:=ActiveWorkbook.Worksheets(1)
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default add-in problems

Try this instead:

Private Sub Workbook_Open()
ThisWorkbook.Worksheets(1).Copy _
After:=ActiveWorkbook.Worksheets(1)
End Sub

RBS

"Jay" wrote in message
ups.com...
I am trying to copy a worksheet from my add-in to the new workbook when
excel opens. I have activated the add-in, but everytime I open Excel,
I get "Object variable or WIth variable not set".
Here is my code

Private Sub Workbook_Open()
Workbooks("Test.xla").Worksheets(1).Copy
after:=ActiveWorkbook.Worksheets(1)
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 8
Default add-in problems

I am still getting the same error. I've used this before, a long while
ago, I wish I knew what was causing it.
Jason

  #4   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 8
Default add-in problems

Hey RBS,
I figured it out. I have to include the workbook.add line of code in
because the add-in actually kicks in before the blank excel book opens,
and if there are no worksheets it returns the error, then opens the
blank excel workbook, without performing the subroutine.
Thanks,
Jay

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default add-in problems

Yes, that is the one. Remember now making a similar mistake once.

RBS

"Jay" wrote in message
oups.com...
Hey RBS,
I figured it out. I have to include the workbook.add line of code in
because the add-in actually kicks in before the blank excel book opens,
and if there are no worksheets it returns the error, then opens the
blank excel workbook, without performing the subroutine.
Thanks,
Jay


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
STILL Having VBA Problems!!!!!!! Elise148 Excel Discussion (Misc queries) 9 July 3rd 07 08:40 PM
Problems merging an excel file due to code or file problems? Cindy M -WordMVP- Excel Programming 0 September 14th 04 02:58 PM
Two little problems Robert Couchman[_6_] Excel Programming 2 August 12th 04 02:49 PM
Problems with XLA:s Ingvar Excel Programming 5 March 2nd 04 03:29 AM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"