You are here: Office-Outlook.com  / Outlook Forum

com addin excel - user switch sheet

Home » Outlook addins and plugins development » Developer Outlook add-ins
com addin excel - user switch sheet [message #185472] Tue, 03 July 2007 04:19 Go to next message
PaulD
Messages: 269
Registered: July 2006
Senior Member
Hi all,

the following code works fine:
(vb6 code for an com addin)
-
Dim ActiveSheet As Object
Dim ActiveFolder As Object

Set ActiveFolder = App.Workbooks(fileName)
Set ActiveSheet = ActiveFolder.Sheets("test")

ActiveSheet.Range("A1").Resize(number1, number2).Value = DataArray
ActiveSheet.Range("F1").Resize(number1, number2).Value = DataArray
-

but not if the user switch between the sheets!!!

How can I make it possible that the user can switch...

any ideas???
Re: com addin excel - user switch sheet [message #185884] Wed, 04 July 2007 06:14 Go to previous messageGo to next message
PaulD
Messages: 269
Registered: July 2006
Senior Member
"XL-Dennis" <XLDennis@discussions.microsoft.com> schrieb im Newsbeitrag
news:019F4D0C-8C76-43CB-9B78-285F3AE3AA4E@microsoft.com...
> Rene,
>
> Why do You use the variable name "Activesheet"? It's part of Excel Object
> model and therefore it should not be used. Change variable name and test.
>
> ---------------
> With kind regards,
> Dennis
> Weekly Blog .NET & Excel: http://xldennis.wordpress.com/
> My English site: http://www.excelkb.com/default.aspx
> My Swedish site: http://www.xldennis.com/
>
>
Hi.

I have changed then name but the the problem still exist.
(its an vb com addin - not vba)
Re: com addin excel - user switch sheet [message #186115] Thu, 05 July 2007 00:54 Go to previous messageGo to next message
PaulD
Messages: 269
Registered: July 2006
Senior Member
Hi.

"Nick Hebb" <NCHebb@gmail.com> schrieb im Newsbeitrag
news:1183582659.901448.176560@i13g2000prf.googlegroups.com...
> If you're using VB6, do not use App as a variable name for the
> Excel.Application. App in VB6 refers to the VB6 Application - in this
> case the COM DLL.
>
> So you would want something like this:
>
> Dim ws As Excel.Worksheet 'or Object for late binding
> Set ws = gxlApp.ActiveSheet ' assumes gxlApp is a global variable
> already set to Excel.Application
>
> ws.Range("A1").Resize(number1, number2).Value = DataArray
>
> HTH,
>
> Nicholas Hebb
> BreezeTree Software
> http://www.breezetree.com
>

I dont use the keyword App. But the error still exist.
Err
Description "Anwendungs- oder objektdefinierter Fehler"
(in english: Application- or object Error)
HelpContext 1000095
HelpFile "C:\WINDOWS\Help\VBENLR98.CHM"
Number 50290

I dont have the chm file...
Re: com addin excel - user switch sheet [message #186116] Thu, 05 July 2007 01:01 Go to previous message
PaulD
Messages: 269
Registered: July 2006
Senior Member
Description "Application Defined or Object Defined Error"
sorry for my bad english ;-)

"Rene" <nospam> schrieb im Newsbeitrag
news:eF0u1mtvHHA.4228@TK2MSFTNGP06.phx.gbl...
> Hi.
>
> "Nick Hebb" <NCHebb@gmail.com> schrieb im Newsbeitrag
> news:1183582659.901448.176560@i13g2000prf.googlegroups.com...
>> If you're using VB6, do not use App as a variable name for the
>> Excel.Application. App in VB6 refers to the VB6 Application - in this
>> case the COM DLL.
>>
>> So you would want something like this:
>>
>> Dim ws As Excel.Worksheet 'or Object for late binding
>> Set ws = gxlApp.ActiveSheet ' assumes gxlApp is a global variable
>> already set to Excel.Application
>>
>> ws.Range("A1").Resize(number1, number2).Value = DataArray
>>
>> HTH,
>>
>> Nicholas Hebb
>> BreezeTree Software
>> http://www.breezetree.com
>>
>
> I dont use the keyword App. But the error still exist.
> Err
> Description "Anwendungs- oder objektdefinierter Fehler"
> (in english: Application- or object Error)
> HelpContext 1000095
> HelpFile "C:\WINDOWS\Help\VBENLR98.CHM"
> Number 50290
>
> I dont have the chm file...
>
>
Previous Topic:Ribbon LoadImage/GetImage callbacks with VB6 COM Add-In
Next Topic:outlook attachement
Goto Forum: