![]() |
Code problems
Hi, I havesome trouble making this excel macro work.
What I need to do is to open a word document that is uplodaded by itīs linked data to the excel, then I need to save it and then print it. The trouble is that PDF asks me for the filename so the user has to enter a name. I tried the named argument filename:= fnamepdf but it doesn't woork. and also Word asks me to press ok because of Normal.dot. Thanks in advace for the help. ----------------------------------------- Sub wordchage() Dim WordApp As Object Set WordApp = CreateObject("Word.Application") fpath = ThisWorkbook.Path doc = fpath & "\" & ("Base.doc") Sheets("Incumbent").Select LetterTemplate = doc fname = Range("A3") fnamedoc = fname & ".doc" With WordApp ..Documents.Open LetterTemplate ..Visible = True End With fname = fname & ".pdf" WordApp.ActiveDocument.PrintOut Background:= False WordApp.ActiveDocument.SaveAs Filename:=fpath & "\" & fnamedoc WordApp.Quit Set WordApp = Nothing End Sub |
All times are GMT +1. The time now is 05:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com