Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with code tac Excel Programming 2 March 10th 06 03:12 AM
sorting code problems DKY[_11_] Excel Programming 1 September 24th 04 03:06 PM
sorting code problems DKY[_10_] Excel Programming 2 September 24th 04 02:34 PM
Problems merging an excel file due to code or file problems? Cindy M -WordMVP- Excel Programming 0 September 14th 04 02:58 PM
VBA Code problems! Simon Lloyd[_463_] Excel Programming 5 May 24th 04 10:21 PM


All times are GMT +1. The time now is 01:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Đ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"