sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,422
- Office Version
- 2016
- Platform
- Windows
I'm using this to save an OLE Word document as a pdf;
What I need to do though is open it after saving - can anyone show me how please?
Code:
Dim appWord As Object
If ActiveWorkbook Is Nothing Then Exit Sub
Application.ScreenUpdating = False
DestFolder = ThisWorkbook.Path & "\Toolbox Files"
Set wsActive = ActiveSheet
lCnt = 0
Sheets("Setup").Activate
Set ws = Sheets("Setup")
ActiveSheet.OLEObjects("Object 2").Select
ActiveSheet.OLEObjects("Object 2").Verb xlVerbPrimary
Set oDoc = ActiveSheet.OLEObjects("Object 2").Object
If appWord Is Nothing Then
Set appWord = oDoc.Parent
End If
oDoc.Bookmarks("IN").Range.InsertAfter H2Frm.ComboI.Value
oDoc.Bookmarks("DA").Range.InsertAfter H2Frm.TextDate.Value & " " & H2Frm.TextTime.Value & " hrs"
oDoc.Bookmarks("RM").Range.InsertAfter H2Frm.TextRM.Value
strFile = "H2 - RM number " & H2Frm.TextRM.Value & ".pdf"
oDoc.SaveAs ThisWorkbook.Path & "\Toolbox Files\" & strFile, FileFormat:=17
oDoc.Close savechanges:=False
lCnt = lCnt + 1
If Not appWord Is Nothing Then
appWord.Quit
End If
Application.ScreenUpdating = True
ActiveWindow.WindowState = xlMaximized
What I need to do though is open it after saving - can anyone show me how please?