Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Excel Sheet using VB 2005
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Excel Sheet using VB 2005
"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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Excel Sheet using VB 2005
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format date as Custom YYYY yields 2005, but fx still shows 1/1/2005 | Excel Programming | |||
Convert alphanumerical(eg. 12.11.2005) to date as 12-Nov-2005 in e | Excel Discussion (Misc queries) | |||
Creating xll files for excel 2003 with Visual C++ 2005 express | Excel Programming | |||
Creating .xll files in visual c++ 2005 express. | Excel Programming | |||
chnage date from tuesday 4 January 2005 10:39.26 to 04/01/2005 | Excel Worksheet Functions |