Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Problem with hiden workbooks

Your code ran fine for me with and without commenting out the line. I ran
the code from Word since I don't have VB6 installed but that shouldn't make
any difference. I'm not sure why you want to hide the window though since
Excel itself is not visible so there's nothing to see in any case.

--
Jim
"Daniel Knueven" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with hiden workbooks

I've been able to recreate the problem on 3 different machines; XP SP1, XP
SP2 and server 2003 all running Office 2003 with and without SP1.

I hide the workbook so the user can't access it and mess up my program. When
I create the application object, it runs another excel.exe which is great.
The problem is when a user double clicks on an excel file, it opens in my
excel instance. This is a problem. Now my excel instance becomes visible
along with my workbook. So, if I hide the workbook, they won't see it when
they double click open their excel file.

"Jim Rech" wrote:

Your code ran fine for me with and without commenting out the line. I ran
the code from Word since I don't have VB6 installed but that shouldn't make
any difference. I'm not sure why you want to hide the window though since
Excel itself is not visible so there's nothing to see in any case.

--
Jim
"Daniel Knueven" wrote in message
...
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




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
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 10:02 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"