rosen0594:
'ThisscripthasbeengeneratedbyPowerPCB'sVBScriptWizardon2006-6-1下午12:24:43'ItwillcreatereportsinMicrosoftExcelFormat.'YoucanusethefollowingcodeasaskeletonforyourownVBscriptsDimfnameAsStringSubMain fname=ActiveDocument Iffname=""Then fname="Untitled" EndIf tempFile=DefaultFilePath&"\temp.txt" OpentempFileForOutputAs#1 Print#1,Space(1);"AssemblyOptionPartListReportfor";fname;"on";Now Print#1 StatusBarText="Generatingreport..." ForEachoptinActiveDocument.AssemblyOptions Print#1 Print#1,Space(1);"AssemblyOption:";GetOptName(opt) Print#1 ForEachpartinopt.Components Print#1,vbTab;part.Name&vbTab&AttrVal(part,"Value") Nextpart Nextopt StatusBarText="" Close#1 ExportToExcelEndSubFunctionGetOptName(optAsObject) GetOptName=Left(opt.Name,Len(opt.Name)-(Len(ActiveDocument.Name)+1))EndFunctionFunctionAttrVal(objAsObject,nmAsString) AttrVal=IIf(obj.Attributes(nm)IsNothing,"",obj.Attributes(nm))EndFunctionSubExportToExcel FillClipboard DimxlAsObject OnErrorResumeNext Setxl=GetObject(,"Excel.Application") OnErrorGoToExcelError 'Enableerrortrapping. IfxlIsNothingThen Setxl=CreateObject("Excel.Application") EndIf xl.Visible=True xl.Workbooks.Add xl.ActiveSheet.Paste xl.Range("A1").Select 'Formatboldlines ForEachrowInxl.ActiveSheet.UsedRange.Rows IfLeft(row.Cells(1),1)=Space(1)Then row.Font.bold=True EndIf Next OnErrorGoTo0'Disableerrortrapping. ExitSub ExcelError: MsgBoxErr.Description,vbExclamation,"ErrorRunningExcel" OnErrorGoTo0'Disableerrortrapping. ExitSubEndSubSubFillClipboard StatusBarText="ExportDataToClipboard..." 'Loadwholefiletostringvariable tempFile=DefaultFilePath&"\temp.txt" OpentempFileForInputAs#1 L=LOF(1) AllData$=Input$(L,1) Close#1 'Copywholedatatoclipboard ClipboardAllData$ KilltempFile StatusBarText=""EndSub