| | |
Can somebody can tell what I am doing wrong!
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2007
Posts: 4
Reputation:
Solved Threads: 0
Dim objNetwork
Dim objExcel
Dim objWorkBook
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
objworkbook.ActiveSheet.Range("A1").value = "DisplayComputername"
Set objNetwork = CreateObject("WScript.NetWork")
Dim strComputer
strComputer = objNetwork.ComputerName
Msg strComputer
Set objNetwork = Nothing
Dim objExcel
Dim objWorkBook
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
objworkbook.ActiveSheet.Range("A1").value = "DisplayComputername"
Set objNetwork = CreateObject("WScript.NetWork")
Dim strComputer
strComputer = objNetwork.ComputerName
Msg strComputer
Set objNetwork = Nothing
What does the error message say?
•
•
•
•
Dim objNetwork
Dim objExcel
Dim objWorkBook
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
objworkbook.ActiveSheet.Range("A1").value = "DisplayComputername"
Set objNetwork = CreateObject("WScript.NetWork")
Dim strComputer
strComputer = objNetwork.ComputerName
Msg strComputer
Set objNetwork = Nothing
•
•
Join Date: Apr 2007
Posts: 4
Reputation:
Solved Threads: 0
Thank you! I find the problem so is somebody whant to look this is the code. Is full find what software are in the comp and save on Excel .
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
objWorkbook.ActiveSheet.Range("A1").Value = "DisplayName"
objWorkbook.ActiveSheet.Range("B1").Value = "InstallDate"
objWorkbook.ActiveSheet.Range("C1").Value = "VersionMajor"
objWorkbook.ActiveSheet.Range("D1").Value = "EstimatedSize"
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default
tdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
For Each strSubkey In arrSubkeys
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
strEntry1a, strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
objWorkbook.ActiveSheet.Range("A" & vLastRow).Value = strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
objWorkbook.ActiveSheet.Range("B" & vLastRow).Value = strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
objWorkbook.ActiveSheet.Range("C" & vLastRow).Value = intValue4
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
objWorkbook.ActiveSheet.Range("D" & vLastRow).Value = Round(intValue5/1024, 3) & " megabytes"
End If
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
Next
objWorkbook.SaveAs ("C:\TEST.xls")
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"
Set objExcel = CreateObject("EXCEL.APPLICATION")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
objWorkbook.ActiveSheet.Range("A1").Value = "DisplayName"
objWorkbook.ActiveSheet.Range("B1").Value = "InstallDate"
objWorkbook.ActiveSheet.Range("C1").Value = "VersionMajor"
objWorkbook.ActiveSheet.Range("D1").Value = "EstimatedSize"
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default
tdRegProv")objReg.EnumKey HKLM, strKey, arrSubkeys
For Each strSubkey In arrSubkeys
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
strEntry1a, strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
objWorkbook.ActiveSheet.Range("A" & vLastRow).Value = strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
objWorkbook.ActiveSheet.Range("B" & vLastRow).Value = strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
objWorkbook.ActiveSheet.Range("C" & vLastRow).Value = intValue4
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
objWorkbook.ActiveSheet.Range("D" & vLastRow).Value = Round(intValue5/1024, 3) & " megabytes"
End If
vLastRow = objWorkbook.Activesheet.UsedRange.Rows.Count + 1
Next
objWorkbook.SaveAs ("C:\TEST.xls")
![]() |
Similar Threads
- My CD-RW plays but won't burn. What could be wrong?? Help Please? (Storage)
- Retrieve email I sent to the wrong person (Web Browsers)
- Ram voltage wrong?? (Motherboards, CPUs and RAM)
- Am I going about this the wrong way (IT Professionals' Lounge)
- wats wrong with imesh??? (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: Navigation (Paging) in HTML table in VB.NET.
- Next Thread: border in word document using vb.NEt
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






