VB Output in Exel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IBGhost
    New Member
    • Apr 2007
    • 2

    #1

    VB Output in Exel

    How can I change the code to give the output in exel sheet or text file.
    The code look like this:
    Code:
    Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
    strComputer = "."
    strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
    strEntry1a = "DisplayName"
    strEntry1b = "QuietDisplayName"
    strEntry2 = "InstallDate"
    strEntry3 = "VersionMajor"
    strEntry4 = "VersionMinor"
    strEntry5 = "EstimatedSize"
    
    Set objReg = GetObject("winmgmts://" & strComputer & _
     "/root/default:StdRegProv")
    objReg.EnumKey HKLM, strKey, arrSubkeys
    WScript.Echo "Installed Applications" & VbCrLf
    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
        WScript.Echo VbCrLf & "Display Name: " & strValue1
      End If
      objReg.GetStringValue HKLM, strKey & strSubkey, _
       strEntry2, strValue2
      If strValue2 <> "" Then
        WScript.Echo "Install Date: " & strValue2
      End If
      objReg.GetDWORDValue HKLM, strKey & strSubkey, _
       strEntry3, intValue3
      objReg.GetDWORDValue HKLM, strKey & strSubkey, _
       strEntry4, intValue4
      If intValue3 <> "" Then
         WScript.Echo "Version: " & intValue3 & "." & intValue4
      End If
      objReg.GetDWORDValue HKLM, strKey & strSubkey, _
       strEntry5, intValue5
      If intValue5 <> "" Then
        WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
      End If
    Next
    Last edited by Killer42; Apr 11 '07, 06:17 AM. Reason: Please use [CODE]...[/CODE] tags around your code.
  • tifoso
    New Member
    • Apr 2007
    • 41

    #2
    If I'm right u r trying to print out the info read from a registry section, if u write it with a comma separated format and name it foobar.csv u should be good to go as excel will read it in. More esoteric if u open an Excel object and play with the methods but this has worked for numerous requests I had i the past.

    Just open a file for writing and carry on looping thru your hit-results

    Ciao

    Becker

    Comment

    Working...