Results 1 to 5 of 5

Thread: Doc File saving

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Location
    Pakistan
    Posts
    24

    Arrow Doc File saving

    i am generating reports as DOC files. I have a problem that i want to save a document as doc file in a folder in the program directory where there is application that is it should use app.path and then the folder name. In the sample below i have to specify the folder location while i want to use app.path. Any help regarding this

    Dim wordapp As Word.Application
    Dim thisdoc As Document
    Dim thisrange As Range
    Set wordapp = CreateObject("word.application")
    If wordapp Is Nothing Then
    MsgBox "could notstart word"
    End If
    wordapp.Documents.Open App.Path & "\templates\SM-00.dot"
    Set thisdoc = wordapp.ActiveDocument
    thisdoc.FormFields(1).Result = txtName.Text
    thisdoc.FormFields(2).Result = txtNo.Text
    thisdoc.FormFields(3).Result = txtRef.Text
    thisdoc.FormFields(4).Result = mskDate.Text
    thisdoc.FormFields(5).Result = txtSpec.Text
    thisdoc.FormFields(6).Result = txtZN.Text
    thisdoc.FormFields(7).Result = txtGm.Text
    thisdoc.FormFields(8).Result = txtKOH.Text


    thisdoc.SaveAs "d:\Reports\SM-" & txtNo.Text & ".doc"
    MsgBox " Doc is saved"
    wordapp.Quit
    Set wordapp = Nothing
    Set thisdoc = Nothing


    "d:\Reports, this should be as App.path & \Reports....
    Last edited by ieesab; Dec 18th, 2005 at 10:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width