M
maperalia
I have a program that save an excel and word file under the same name ( see
below). However, when I change revision for both the program has been calling
for the template.doc instead of the last word revision.
I want to know is it possible to make the program to call the last word
revision file instead of the template. Obviously, I need this after the first
file was created it because I need the template as a start point.
Thanks in advance.
Maperalia
'*********************************************************
Function SaveExcelTemplatelAsSaveAs() As String
Application.ScreenUpdating = False
Dim WO As String
Dim grdprp As String
Dim sFilename As String
Dim Progname As String
Dim Filename As String
Dim myDateTime As String
WO = Worksheets("summary BLR").Range("M10")
myDateTime = Format(Worksheets("summary BLR").Range("M9").Value, "yyyymmdd")
Filename = "" & WO & "_grdprp_" & myDateTime & ""
Progname = "C:\Test \" & Filename & ".xls"
'***************************************************************
'SAVE THE FILENAME
ActiveWorkbook.SaveCopyAs Progname
SaveExcelTemplatelAsSaveAs = Progname
'***************************************************************
'*******************************************************
'OPEN THE FILENAME
Workbooks.Open Filename:=Progname
'******************************************************
End Function
'***********OPEN THE TEMPLATE WORD FILE *********************
Sub OpenWordAndUpdateLinks(sPathToExcelFile As String)
Application.ScreenUpdating = False
Dim wordApp As Object
Dim fNameAndPath As String
Dim Filename As String
fNameAndPath = "C:\Test\Template.doc"
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (fNameAndPath)
wordApp.Visible = True
wordApp.Activate
'**********************************************************
'NEXT MACRO IS LOCATED IN THE WORD DOCUMENT
wordApp.Run macroname:="UpdateLinks", vArg1:=sPathToExcelFile
Set wordApp = Nothing
'**********************************************************
'CLOSE ACTIVE FILE
ThisWorkbook.Close SaveChanges:=False
'*********************************************************
End Sub
below). However, when I change revision for both the program has been calling
for the template.doc instead of the last word revision.
I want to know is it possible to make the program to call the last word
revision file instead of the template. Obviously, I need this after the first
file was created it because I need the template as a start point.
Thanks in advance.
Maperalia
'*********************************************************
Function SaveExcelTemplatelAsSaveAs() As String
Application.ScreenUpdating = False
Dim WO As String
Dim grdprp As String
Dim sFilename As String
Dim Progname As String
Dim Filename As String
Dim myDateTime As String
WO = Worksheets("summary BLR").Range("M10")
myDateTime = Format(Worksheets("summary BLR").Range("M9").Value, "yyyymmdd")
Filename = "" & WO & "_grdprp_" & myDateTime & ""
Progname = "C:\Test \" & Filename & ".xls"
'***************************************************************
'SAVE THE FILENAME
ActiveWorkbook.SaveCopyAs Progname
SaveExcelTemplatelAsSaveAs = Progname
'***************************************************************
'*******************************************************
'OPEN THE FILENAME
Workbooks.Open Filename:=Progname
'******************************************************
End Function
'***********OPEN THE TEMPLATE WORD FILE *********************
Sub OpenWordAndUpdateLinks(sPathToExcelFile As String)
Application.ScreenUpdating = False
Dim wordApp As Object
Dim fNameAndPath As String
Dim Filename As String
fNameAndPath = "C:\Test\Template.doc"
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (fNameAndPath)
wordApp.Visible = True
wordApp.Activate
'**********************************************************
'NEXT MACRO IS LOCATED IN THE WORD DOCUMENT
wordApp.Run macroname:="UpdateLinks", vArg1:=sPathToExcelFile
Set wordApp = Nothing
'**********************************************************
'CLOSE ACTIVE FILE
ThisWorkbook.Close SaveChanges:=False
'*********************************************************
End Sub