Error in setting value of a range

S

sai

I have a sheet called Step2 and I am using the following statement

Globals.Step2.Range("A6").Value ="Test"

This used to work before with VSTO 2005 Beta 1. I am now using Beta 2.
I get the following error

System.Runtime.InteropServices.COMException occurred
ErrorCode=-2146827284
Message="Exception from HRESULT: 0x800A03EC"
Source="Microsoft.Office.Interop.Excel"
StackTrace:
at Microsoft.Office.Interop.Excel._Worksheet.get_Range(Object
Cell1, Object Cell2)

When I type
?globals.Step1.Range("A1").Value
in the immediate pane I get the following response
'globals' is ambiguous, imported from the namespaces or types

Can someone please help me figure this out?

Thanks,

Sai
 
N

Nick Hodge

Sai

Not sure the Globals will know what it refers to as it can equally apply to
the workbook or worksheet depending on context. I would actually use the
workbook name rather than 'Globals'...should work

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top