|
can you specify which hardware you want? you can try use the wmi
|
|
|
|
|
I am developing a VB.NET application which dumps data and calculations to Excel. I am trying to write code to add a comment to a cell with the command
EXL.DisplayCommentIndicator = Excel.XlCommentDisplayMode.xlCommentIndicatorOnly
EXL.Range(x).AddComment(comment as text)
No matter how I write the code I always get the following error:
"An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Exception from HRESULT: 0x800A03EC."
Can anyone tell me what I am doing wrong?
Thankks!
nvmoss
|
|
|
|
|
Of course, add a reference to the current project to the Excel library. Then, your code should appear something like this:
Dim xl As New Excel.Application
xl.Workbooks.Open("c:\000\book1.xls")
xl.DisplayCommentIndicator = Excel.XlCommentDisplayMode.xlCommentIndicatorOnly
xl.Range("Value1").AddComment("This is a comment")
xl.ActiveWorkbook.Save()
xl.Workbooks.Close()
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Your suggestion doesn't work for me. Here is the code fragment I wrote:
If CtrlP.Text <> "" Then
Dim Com As String
Dim ComRng As String
Com = CType(CtrlP.Text, String)
If IsNothing(lastcell) Then lastcellA = "B11"
EXL.DisplayCommentIndicator = XlCommentDisplayMode.xlCommentIndicatorOnly
ComRng = EXL.Range(lastcellA).Offset(0, 10).Address(rowabsolute:=False, columnabsolute:=False)
EXL.Range(ComRng).AddComment(Com)
End If
Where EXL is the Excel application, lastcell is the last non-empty cell in the spreadsheet range in which I am dumping data, and lastcellA is the address of that cell.
When I execute this code, I get the error message I copies in my original posting.
What am I doing wrong?
Thanks again for your help!
nvmoss
|
|
|
|
|
That's odd, my suggestion works for me; or, at least, it does run.
You should realize that the stuff you're passing to the Address method won't work in VB.NET, those statements only work in Excel macros & VBA.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
Boy! I don't know what to do next. I changed computes last week. The new computer was loaded with Excel 2003, rather than the Excel 2002 that I had been using. I built this application onec before I realized that the Excel OM Library upgrade would be an issue. Ever since I switched back to Excel 2002, I have been getting a build error "The IBDE can't be found". It hasn't stopped the build. could this be related to the problem?
As to the Address method, it returns the cell address correctly in VB.NET. Is this likely to cause a problem during run time?
Thanks Again!
nvmoss
|
|
|
|
|
Try adding and removing the reference to the Excel libs from your project. Other than that, I'm tapped out.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
I found a help file on this and thought you would like to know the answer. I had to find the Interop.VBIDE.dll file using windows explorer, then browse to the location in the Add Reference Dialog and add it to the project.
The problem ws the the location had apparantly changes when I switched computers.
Thanks again for your help!
nvmoss
|
|
|
|
|
VS.NET generates an Interop.VBIDE.dll -- but which DLL does it reference and where is it located?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
John -
I got the debug error message wrong in my last reply. It is "Interop.VBIDE was not found."
Sorry!
nvmoss
|
|
|
|
|
i m fairly new to crystal reports.can anybody plz tell me how to use crystal reports in VB and how to pass parameters in the report at run time
preeti
|
|
|
|
|
Although it might depend on which version of Crystal Reports you are using, there is something like a Parameters collection for report parameter variables, accessed with either an integer, (i.e., rpt.Parameters(1).Value = "XYZ") or the name of the parameter (i.e., rpt.Parameters("NAME").Value = "XYZ") all of which should be documented in the Crystal Reports documentation, but, if necessary, I can find the exact code I used last time I did this with CR 8.5. I'd have to experiment with CR 9.x+ to see if works the same way.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
OK, here's what I did in VB6 w/ Cr8.5:
Set crystalApplication = New CRAXDDRT.Application
Set crystalReport = crystalApplication.OpenReport(strReportFile, 1)
With crystalReport
.ExportOptions.DiskFileName = strExportFile
.ExportOptions.DestinationType = crEDTDiskFile
.ExportOptions.FormatType = crEFTWordForWindows ' crEFTPortableDocFormat
.ExportOptions.WORDWExportAllPages = True
.DisplayProgressDialog = False
.ParameterFields(1).AddCurrentValue strGroupName
' .RecordSelectionFormula = strSelection
.Export False
End With
Set crystalReport = Nothing
Set crystalApplication = Nothing
FYI, to the best of my knowledge, this requires CR 8.5 developer edition.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
I have inserted normal files in setup but how to go bout merge modules in a setup is not happening. how to insert merge module in a setup.
thanx
Be Humble in Victory and Strong in Defeat. -Het
|
|
|
|
|
Can anyone tell me please! where I can find free vb.net tutorials.
Thanks
|
|
|
|
|
try this link below
http://www.dotnetspider.com/technology/
http://www.programmingtutorials.com/vbnet.aspx
http://www.vbdotnetheaven.com/Sections/Tutorials.asp
most of the site teach u by showing example.....you can learn from the examples....;)
|
|
|
|
|
hey im just starting visual basic at my school and i was trying to make a program that sends an anonymous net send. I've already got the main stuff down to send the message, i just dont know how to make it anonymous. Any help?
|
|
|
|
|
|
|
|
sorry, but i cant install all this stuff on the school computers. Is there any way to do it through VB? The first link you gave me added something about a 'netmessagenameadd' command. Is there anything like that in VB?
|
|
|
|
|
|
Hi all,
Is there a way to retrieve the name of the variable containing an object passed to a subrouting. Here is a simple illustration meant to explain my question;
I have the following two class defintions
Public Class Address
public City as string
...
End Class
Public Class Organisation
Public MailingAddress as new Address
public BillingAddress as new Address
public sub CallSomething()
' pass the object whose variable name we want to display
CallingSomething(MailingAddress)
end sub
public sub CallingSomething(objAddress as Address)
'display the name of the variable of objAddress as it is known in my Class Organisation. The display should be "MailingAddress".
end sub
End Class
Using objAddress.GetType.Name gives me the "Address" which is the class name but I'm looking for the variable name "MailingAddress". If I had passed the BillingAddress, obviously I would want to display "BillingAddress". Can this be done in VB.NET?
Thanks in advance.
Ronald Bastien.
Strategium Technologies inc.
|
|
|
|
|
Ronald Bastien wrote:
CallingSomething(MailingAddress)
cant you just put "MailingAddress", including the quotes, as the paramater to pass to the CallingSomething procedure?
------------------------
Jordan.
III
|
|
|
|
|
I could but I'm already passing the object so I don't want to pass the name as well. This object can also be passed down through an hierachy of calls and again, I don't want to have to pass the name with the object.
Cheers.
Ronald Bastien
Strategium Technologies inc.
|
|
|
|