By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,882 Members | 2,082 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,882 IT Pros & Developers. It's quick & easy.

VB Output in Exel

P: 2
How can I change the code to give the output in exel sheet or text file.
The code look like this:
Expand|Select|Wrap|Line Numbers
  1. Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
  2. strComputer = "."
  3. strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
  4. strEntry1a = "DisplayName"
  5. strEntry1b = "QuietDisplayName"
  6. strEntry2 = "InstallDate"
  7. strEntry3 = "VersionMajor"
  8. strEntry4 = "VersionMinor"
  9. strEntry5 = "EstimatedSize"
  10.  
  11. Set objReg = GetObject("winmgmts://" & strComputer & _
  12.  "/root/default:StdRegProv")
  13. objReg.EnumKey HKLM, strKey, arrSubkeys
  14. WScript.Echo "Installed Applications" & VbCrLf
  15. For Each strSubkey In arrSubkeys
  16.   intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
  17.    strEntry1a, strValue1)
  18.   If intRet1 <> 0 Then
  19.     objReg.GetStringValue HKLM, strKey & strSubkey, _
  20.      strEntry1b, strValue1
  21.   End If
  22.   If strValue1 <> "" Then
  23.     WScript.Echo VbCrLf & "Display Name: " & strValue1
  24.   End If
  25.   objReg.GetStringValue HKLM, strKey & strSubkey, _
  26.    strEntry2, strValue2
  27.   If strValue2 <> "" Then
  28.     WScript.Echo "Install Date: " & strValue2
  29.   End If
  30.   objReg.GetDWORDValue HKLM, strKey & strSubkey, _
  31.    strEntry3, intValue3
  32.   objReg.GetDWORDValue HKLM, strKey & strSubkey, _
  33.    strEntry4, intValue4
  34.   If intValue3 <> "" Then
  35.      WScript.Echo "Version: " & intValue3 & "." & intValue4
  36.   End If
  37.   objReg.GetDWORDValue HKLM, strKey & strSubkey, _
  38.    strEntry5, intValue5
  39.   If intValue5 <> "" Then
  40.     WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
  41.   End If
  42. Next
Apr 10 '07 #1
Share this Question
Share on Google+
1 Reply


tifoso
P: 41
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
Apr 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.