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: IBGhost is an unknown quantity at this point 
Solved Threads: 0
IBGhost IBGhost is offline Offline
Newbie Poster

Can somebody can tell what I am doing wrong!

 
0
  #1
May 1st, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 216
Reputation: jamello is an unknown quantity at this point 
Solved Threads: 6
jamello's Avatar
jamello jamello is offline Offline
Posting Whiz in Training

Re: Can somebody can tell what I am doing wrong!

 
0
  #2
May 2nd, 2007
What does the error message say?
Originally Posted by IBGhost View Post
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Can somebody can tell what I am doing wrong!

 
0
  #3
May 2nd, 2007
I assume you've added the relevant com library
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 4
Reputation: IBGhost is an unknown quantity at this point 
Solved Threads: 0
IBGhost IBGhost is offline Offline
Newbie Poster

Re: Can somebody can tell what I am doing wrong!

 
0
  #4
May 3rd, 2007
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/defaulttdRegProv")
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")
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC