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

Excel VBScript for Data Entry and Save

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)
11 views1 page

Excel VBScript for Data Entry and Save

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

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("[Link]")
[Link] strExcelPath
Set objSheet = [Link](1)

' Write Cell value for M3/H.


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

' Write Cell value for MWC.


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

' Write Cell value for KW.


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

' Write Cell value for AMP.


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

' Write Cell value for EFF. (Bending)

' Save and quit.


'[Link]
[Link] strSaveAsPath
[Link]
[Link]

' SaveAs, Print and quit.

[Link] strSaveAsPath
[Link]
[Link]

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

You might also like