0% found this document useful (0 votes)
73 views1 page

VB Script

The document opens an Excel spreadsheet, selects the first worksheet, and writes values from SmartTags variables to cells in columns 2 through 5, rows 2 through 7. It then saves the spreadsheet to a new file path, closes and quits Excel.

Uploaded by

Jayrold Agustin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views1 page

VB Script

The document opens an Excel spreadsheet, selects the first worksheet, and writes values from SmartTags variables to cells in columns 2 through 5, rows 2 through 7. It then saves the spreadsheet to a new file path, closes and quits Excel.

Uploaded by

Jayrold Agustin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Dim objExcel, strExcelPath, strSaveAsPath, objSheet

strExcelPath = "D:\1HPTemplate_Graph.xlsx"
strSaveAsPath = "D:\00_PROJECTS\1HPTemplate_Graphs.xlsx"
' Open specified spreadsheet and select the first worksheet.
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open strExcelPath
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

' Write Cell value for M3/H.


objSheet.Cells(2,2).Value = "0"
objSheet.Cells(3,2).Value = SmartTags("LPH_1")
objSheet.Cells(4,2).Value = SmartTags("LPH_2")
objSheet.Cells(5,2).Value = SmartTags("LPH_3")
objSheet.Cells(6,2).Value = SmartTags("LPH_4")
objSheet.Cells(7,2).Value = SmartTags("LPH_5")

' Write Cell value for MWC.


objSheet.Cells(2,3).Value = "0"
objSheet.Cells(3,3).Value = SmartTags("MWC_1")
objSheet.Cells(4,3).Value = SmartTags("MWC_2")
objSheet.Cells(5,3).Value = SmartTags("MWC_3")
objSheet.Cells(6,3).Value = SmartTags("MWC_4")
objSheet.Cells(7,3).Value = SmartTags("MWC_5")

' Write Cell value for KW.


objSheet.Cells(2,4).Value = "0"
objSheet.Cells(3,4).Value = SmartTags("KW_1")
objSheet.Cells(4,4).Value = SmartTags("KW_2")
objSheet.Cells(5,4).Value = SmartTags("KW_3")
objSheet.Cells(6,4).Value = SmartTags("KW_4")
objSheet.Cells(7,4).Value = SmartTags("KW_5")

' Write Cell value for AMP.


objSheet.Cells(2,5).Value = "0"
objSheet.Cells(3,5).Value = SmartTags("AMP_1")
objSheet.Cells(4,5).Value = SmartTags("AMP_2")
objSheet.Cells(5,5).Value = SmartTags("AMP_3")
objSheet.Cells(6,5).Value = SmartTags("AMP_4")
objSheet.Cells(7,5).Value = SmartTags("AMP_5")

' Write Cell value for EFF. (Bending)

' Save and quit.


'objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.SaveAs strSaveAsPath
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit

' SaveAs, Print and quit.

objExcel.Workbooks.Open strSaveAsPath
objExcel.ActiveWorkbook.PrintOut
objExcel.ActiveWorkbook.Close

--------------------------------------

You might also like