LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with hiden workbooks

I am using a hidden workbook to generate graphs using Excel. I was having a
problem adding a label to the chart while the workbook was hidden. So, I
installed SP1 for Office 2003 to see if that would fix the problem. Now, I
can't even add a chart to the workbook when it is hidden. I am running on
Windows XP SP2. I would appreciate any help.

Included is code that can reproduce the problem:

'-----------------------------------------------------------------------
Option Explicit

Private Const msoOrientationHorizontal As Long = 1
Private Const msoTrue As Long = -1

Private Sub Form_Load()

Dim oExcelApp As Object
Dim oExcelBook As Object
Dim oExcelChart As Object
Dim oExcelShape As Object

Set oExcelApp = CreateObject("Excel.Application")

Set oExcelBook = oExcelApp.Workbooks.Add

' Comment out the following line and everything will work
oExcelBook.Windows(1).Visible = False

' If SP1 for office 2003 is installed, this line fails with the
following error
' Run-time error '-2147417851 (80010105)': Method 'Add' of object
'Sheets' failed
Set oExcelChart = oExcelBook.Charts.Add

' If SP1 is not installed, this line fails with the following error
' "run-time error '1004': Application-defined or object-defined error"
Set oExcelShape = oExcelChart.Shapes.AddLabel(msoOrientationHorizont al,
0, 0, 10, 10)

oExcelShape.TextFrame.Characters.Text = "Hello"
oExcelShape.Line.Visible = msoTrue
oExcelShape.TextFrame.AutoSize = True

oExcelBook.Close False

oExcelApp.Quit

Set oExcelShape = Nothing
Set oExcelChart = Nothing
Set oExcelBook = Nothing
Set oExcelApp = Nothing

Unload Me

End Sub
 
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
various printing from a hiden sheet Shawn O'Donnell Excel Programming 3 March 7th 05 09:29 PM
Why can't I unhide a hiden row JBurke Excel Discussion (Misc queries) 7 January 8th 05 03:59 PM
Is column hiden? ianripping[_100_] Excel Programming 0 November 5th 04 04:24 PM
Is column hiden? ianripping[_99_] Excel Programming 2 November 5th 04 12:08 PM
hiden sheet scrabtree[_2_] Excel Programming 3 August 4th 04 02:55 PM


All times are GMT +1. The time now is 05:16 AM.

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

About Us

"It's about Microsoft Excel"