Private Sub Form_Load()
d = Now
d = Format(Now, "dd-mmm-yy")
PivRefFILE = "\\GLNSFS1\groups\POS\GWW_MMS_DATA" & "\Tasks\PivRefreshCheck\T_LOG" & Format(d, "yyyymmdd") & ".LOG"
Open PivRefFILE For Append As #1
Write #1, "Pivot refresh for " & d - 1 & ". was started at " & Now() & "."
Close #1
On Error Resume Next
Sql_Prod
Open PivRefFILE For Append As #1
Write #1, "Pivot refresh for " & d - 1 & " finished at " & Now() & "."
Write #1, "COMPLETED"
Close #1
End
End Sub
Public Sub OpenSpreadsheet(ByVal strDataDirectory As String)
Set xlApp = New Excel.Application ' Make sure excel is running
xlApp.Workbooks.Open strDataDirectory, , False, , , , True ' Load the work file (read only)
Set xlBook = xlApp.Workbooks(1) ' Get a pointer to the workbook
End Sub
Public Sub Sql_Prod()
Open PivRefFILE For Append As #1
Write #1, "Pivot refresh for prod was started at " & Now() & "."
Close #1
strDataDirectory = "\\GLNSFS\groups\POS\GWW_MMS_Data\CurrentProd\RMN_Current_prod\Prod\mmsprod_PIV_QUERYRMN.xls"
OpenSpreadsheet strDataDirectory
Set xlsheet = xlBook.Sheets(1)
xlsheet.PivotTables("PivotTable1").PivotSelect "", xlDataAndLabel, True
xlsheet.PivotTables("PivotTable1").PivotCache.Refresh
xlBook.Save
xlBook.Close
xlApp.Quit
End Sub
I am trying to translate this VB code into VB.net code
I am having some difficulty understand part of the code
I know this program is to go into Excel files and refresh the specific pivot tables and then save the file as a new file with a new name with the current date added into the orginal file name
however i have no idead what these lines does
Open PivRefFILE For Append As #1
Write #1, "Pivot refresh for " & d - 1 & ". was started at " & Now() & "."
Close #1
On Error Resume Next
Sql_Prod
Open PivRefFILE For Append As #1
Write #1, "Pivot refresh for " & d - 1 & " finished at " & Now() & "."
Write #1, "COMPLETED"
Close #1
any help will be appreciated
can someone reccomend a website that can aid me in this task
thanks