Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Using Container in Auto open macro

Hi,
I have an excel file which is embedded in some application. I ahve a
macro written in the excel file. I want the macro to run automatically
as soon as I open the excel sheet. For this I used the Workbook_Open
macro. But inside this macro if I try to call the Container method, I
am getting an error.

<code
Private Sub Workbook_Open()
Dim x As Object
Worksheets("Sheet1").Activate
Set x = ThisWorkbook.Container
End Sub

</code

But, instead of using the Workbook_Open macro, I use some other macro,
say macro1, and then run that macro manucally after opening the excel
sheet, I get no error. Does anyone have any idea why it does not work
when I use Workbook_Open macro? I want the macro to run as soon as I
open the excel sheet.

<code

Private Sub macro1()
Dim x As Object
Worksheets("Sheet1").Activate
Set x = ThisWorkbook.Container
End Sub

</code

Regards,
AA

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
Can a Macro open workbooks on a SharePoint Site? Randy Excel Discussion (Misc queries) 0 August 29th 06 07:21 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Auto Run a Macro Pam Coleman Excel Discussion (Misc queries) 2 May 3rd 05 02:58 PM
Macro that will add data from multiple workbooks to the 1st open r jbsand1001 Excel Discussion (Misc queries) 0 April 23rd 05 07:52 PM
open file (as variable) from macro d chaps Excel Discussion (Misc queries) 1 March 14th 05 11:57 PM


All times are GMT +1. The time now is 10:13 AM.

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"