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: 1
Default VB.Net DLL Using Excel Named Ranges

Hello and Help!

I have created a .Net DLL using the following in VB.Net:

Imports Excel
<ComClass(NameSpaceClass.ClassId, NameSpaceClass.InterfaceId
NameSpaceClass.EventsId) _
Public Class NameSpaceClass

#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String
"DD3F5A18-99E3-4797-8004-B61A6013466F"
Public Const InterfaceId As String
"EB6EBB23-0528-48F9-AF68-7FD23B25FF10"
Public Const EventsId As String
"672CB2A1-C839-4157-97E7-EB73B430ADCB"
#End Region

' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

'Dim ktfn As Excel.Range
Public Function showNum() As Single
showName
CType(xlApp.ActiveWorkbook.Application.Range("Exce lValue").Value
Single)
End Function
End Class


\VB.Net

Now I have also some code as follows in an Excel VBA Module:


Option Explicit
Option Base 1
Global ExcelValue As Range
Dim NameSpaceInstance As New NameSpacePlayer.NameSpaceClass


Function showNum() As Single
showNum = NameSpaceInstance .showNum
End Function

Function vbaNum() As Single
vbaNum = Range("ExcelValue").value
End Function

/VBA


what these two should do is return the value of a cell name
ExcelValue. ExcelValue can be any single cell such as A1 on Sheet1 o
B40 on Sheet 2...the cell name, ExcelValue, is global so that it can b
moved if needed without modifying any written code. With VBA this work
because of the integration between Excel and VBA but it has been
challenge getting my VB.Net COM DLL to get with the program.

Does anyone have any ideas

--
Message posted from http://www.ExcelForum.com

 
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
Excel 2007 Named Ranges Barb Reinhardt Excel Discussion (Misc queries) 0 September 22nd 08 08:01 PM
How can I name worksheets in Excel according to named ranges? Dominique Excel Worksheet Functions 4 September 1st 06 09:03 AM
Accessing named ranges in Excel from VBA Basz Excel Discussion (Misc queries) 1 August 10th 05 03:21 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM


All times are GMT +1. The time now is 12:52 PM.

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"