944,055 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 2202
  • VB.NET RSS
May 1st, 2007
0

Can somebody can tell what I am doing wrong!

Expand 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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
IBGhost is offline Offline
4 posts
since Apr 2007
May 2nd, 2007
0

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

What does the error message say?
Click to Expand / Collapse  Quote originally posted by IBGhost ...
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
Reputation Points: 215
Solved Threads: 6
Posting Whiz in Training
jamello is offline Offline
219 posts
since Oct 2006
May 2nd, 2007
0

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

I assume you've added the relevant com library
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
May 3rd, 2007
0

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

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")
Reputation Points: 10
Solved Threads: 0
Newbie Poster
IBGhost is offline Offline
4 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Navigation (Paging) in HTML table in VB.NET.
Next Thread in VB.NET Forum Timeline: border in word document using vb.NEt





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC