PC Review


Reply
Thread Tools Rate Thread

Creating Excel Sheet using VB 2005

 
 
mdup
Guest
Posts: n/a
 
      19th Feb 2010
I am trying to connect to servers and import data and attributes from the
servers into excel. What is the best way to do this? I have to connection
part of the code wriitten and can connect to any server I choose. I am not
working on creating the excel spreadsheet with the data.

I have Imported the Microsoft.Office.Interop.Excel package into my program.
Should I be using the ListColumns.Add and the ListRows.Add functions to
populate the spreadsheet from the data imported by the server?

Thanks in advance.
 
Reply With Quote
 
 
 
 
mdup
Guest
Posts: n/a
 
      19th Feb 2010


"mdup" wrote:

> I am trying to connect to servers and import data and attributes from the
> servers into excel. What is the best way to do this? I have to connection
> part of the code wriitten and can connect to any server I choose. I am now
> working on creating the excel spreadsheet with the data.
>
> I have Imported the Microsoft.Office.Interop.Excel package into my program.
> Should I be using the ListColumns.Add and the ListRows.Add functions to
> populate the spreadsheet from the data imported by the server?
>
> Thanks in advance.

 
Reply With Quote
 
mdup
Guest
Posts: n/a
 
      19th Feb 2010
Sorry I mistyped some of the initial post. I am NOW (instead of not) working
on creating the excel spreadsheet with the data. I have been using the Object
Browser to try and find the commands I need to use to import the data. Below
is a code i have written to import the data but it does have some issues.



#Region " (Import Data) This function will import the PI Tag Names and
desired Attributes into an Excel worksheet "
Private Sub Import()
'Declare Variables for Data Retrevial

'Dim srv As Server ' server object
Dim nvs As PISDKCommon.NamedValues 'list of attribute names to
get
Dim piPoint As PIPoint
Dim pAttrs As PISDKCommon.NamedValues
Dim pAtt As PISDKCommon.NamedValue
Dim pList As PointList
Dim getEx As IGetPoints2
Dim List1 As Excel.RTD
Dim List2 As Excel.RTD

On Error GoTo err
getEx = myServer


pList = getEx.GetPoints2("tag='" & " * " & "'", nvs,
GetPointsRetrievalTypes.useGetPoints)
For Each piPoint In pList
List1.AddItem(piPoint.Name)
Next
Exit Sub
err:
MsgBox("Error in call:" & Err.Description)

On Error Resume Next

List2.Clear()
piPoint = myServer.PIPoints(List1.Text)
pAttrs = piPoint.PointAttributes.GetAttributes 'Fetch returned
attributes as NamedValues
For Each pAtt In pAttrs 'Run thru all attributes
List2.AddItem(pAtt.Name & ": " & CStr(pAtt.Value)) 'Show name
and value
Next

nvs = New PISDKCommon.NamedValues
nvs.Add("archiving", 1)



And more attributes follow the nvs.Add("archiving") line. I am also not sure
if this is how List1 and List2 should be defined Dim List1 As Excel.RTD, Dim
List2 As Excel.RTD. I thought more details on the code and and problem I am
having would help. The code is being written so that it does not require any
clicking to operate. This should be an automated process.

Thanks again in advance.

"mdup" wrote:

> I am trying to connect to servers and import data and attributes from the
> servers into excel. What is the best way to do this? I have to connection
> part of the code wriitten and can connect to any server I choose. I am not
> working on creating the excel spreadsheet with the data.
>
> I have Imported the Microsoft.Office.Interop.Excel package into my program.
> Should I be using the ListColumns.Add and the ListRows.Add functions to
> populate the spreadsheet from the data imported by the server?
>
> Thanks in advance.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a chart in Excel using VC++ .net 2005 antarikshv Microsoft Dot NET Framework 2 17th Oct 2007 05:02 AM
Creating chart in Excel using vc++ .net 2005 antarikshv Microsoft VC .NET 0 16th Oct 2007 01:20 PM
Upload Excel Sheet -> Import to SS 2005 Kbalz Microsoft ASP .NET 3 8th Nov 2006 03:32 PM
Creating xll files for excel 2003 with Visual C++ 2005 express =?Utf-8?B?SmFja3NvblJKb25lcw==?= Microsoft Excel Programming 0 15th Mar 2006 10:06 PM
Excel sheet with 2005 calendar w/automatic tabulation of entries =?Utf-8?B?Sm9obiBTaHVzdGVy?= Microsoft Excel Charting 1 8th Oct 2004 06:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:45 PM.