Report inappropriate content using these instructions. This article explains how to use a VBScript application to read a single-column Excel spreadsheet containing a list of computers, check that list against Active Directory AD , and then update the spreadsheet with the corresponding computer's AD Description field, if present. Below is an example of what the initial spreadsheet would look like. In this scenario, the below primary constraints were tested:. The tested list includes the specific entries listed below:.
Below is a screen-shot of the initial pre-script servers. Alternatively, you may already have a number of server names with Description fields already filled in. This will not be an issue, since the script automatically will bypass any Excel server record that already contains a non-blank description beside it in Column 2.
Therefore, it is acceptable for your initial spreadsheet already to contain data in Column 2. Note: You may, if desired, customize the script to have different behavior if Column 2 contains data; i.
NOTE: Below is only a snippet portion of the full code for general understanding. The basic premise that the code uses is as follows: 1 Read through all rows of Col 1 on an Excel document Main code section. Option Explicit. Dim objExcel. Quit 'WScript. Echo "Finished. Aaron, It looks like what you have is almost there. However, can you please clarify if you are tryig to open an existing.
First off, keep in mind that the application set is different from the workbook set. Threfore, you set the variable "objWorkbook" but you don't use it. Do that first and it'll make it a bit easier to work with. If you are trying to open an existing file and workbook, then the line: objExcel.
WorkSheets 1. Activate Also, when hard coding the file anem you can either use: objExcel. Activate objWorkbook. Close objExcel. Quit WScript. Quit I found that this worked if I used objExcel. Save or I could use objExcel. Saveas With a file path at the end I dont think that save supports a file location. Add objExcel. No, it does not work for me. The file is getting saved but my changes in the saved file does not display.
Also while closing the file, it ask for save or not. Value objExcel. Cells x, 2. Fields "givenName". Cells x, 3. Fields "department". Cells x, 4. Fields "telephoneNumber". Range "A1" objRange. Range "B1" objRange. Range "C1" objRange. Range "D1" objRange. Range "A1". Range "A1" List Excel Color Values Demonstration script that displays the various colors -- and their related color index -- available when programmatically controlling Microsoft Excel.
Cells i, 1.
0コメント