Results 1 to 13 of 13
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    word from Access (access2000)

    Hi guys!
    When I open word form access it only opens as a very small square on the top left hand corner. I cannot see anything nor can I maximise it.
    If you have a look at the screen shot I've attached you'd know what I mean.
    Please help to overcome this problem??

    SORRY couldn't attach it. anyways its very small & when I maximise it it only shows the scrolling bar. To open the document, I have to close and open it .

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: word from Access (access2000)

    How exactly are you opening it from Access? You can't assume everyone has read all your other posts.
    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    Im using a module to open word.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: word from Access (access2000)

    That isn't specific enough. Post the code.
    Charlotte

  5. #5
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    <pre>Option Compare Database
    Const CSTR_SAVEPATH As String = "S:SRI_WORK_AREADOCUME~1"
    Const CSTR_DOCSPATH As String = "T:TradeAdminSysDevelopment"
    Sub CitcoFax()
    Dim strFileName As String, strMsg As String, vResult As Variant
    Dim strFilenamePart As String, appWord As Object
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim rstRecipients As DAO.Recordset
    Dim strFund As String
    Dim rstCitco As DAO.Recordset
    Dim strTDate As Date
    Dim objWord As Object, strMessage As String, strMsgTitle As String
    strFund = "Soros"
    'Turn System warnings off
    DoCmd.SetWarnings False
    'Delete contents of the table
    DoCmd.RunSQL "DELETE [tblCitco].* FROM [tblCitco] WITH OWNERACCESS OPTION;", 0
    'Run Append query to add SFM records to the table
    DoCmd.OpenQuery "AppToCitco", acNormal, acEdit
    'Turn System warnings on.
    DoCmd.SetWarnings True
    'message to remind user to close any active word documents.
    MsgBox "Close any active word documents, click on OK to continue.", _
    vbInformation + vbMsgBoxSetForeground, strMsgTitle
    Set db = CurrentDb
    Set rst = db.OpenRecordset("tblCitco")
    If rst.BOF And rst.EOF Then
    vResult = MsgBox("There are no records. Would you like to send a fax?", _
    vbQuestion + vbYesNo + vbMsgBoxSetForeground)
    If vResult = vbYes Then
    'set value to merge
    Set rstRecipients = db.OpenRecordset("tblRecipient", dbOpenDynaset)
    With rstRecipients
    .MoveFirst
    .FindFirst "[Fund] = '" & strFund & "'"
    .Edit
    !Merge = True
    .Update
    End With
    Set rstRecipients = Nothing
    'Output data to spreadsheet
    strFileName = CSTR_DOCSPATH & "FAXSOURCE.xls"
    DoCmd.OutputTo acOutputQuery, "qryRecipient", acFormatXLS, strFileName, False
    'Open fax cover
    Set objWord = GetObject(CSTR_DOCSPATH & "Fax.doc", "Word.Document")
    'Make word visible
    With objWord
    .Application.Visible = True
    'Execute the mail merge
    With .MailMerge
    .destination = wdSendToNewDocument
    .Execute
    End With
    Set appWord = .Application
    End With
    appWord.DisplayAlerts = wdAlertsNone
    objWord.Close
    appWord.DisplayAlerts = wdAlertsAll
    'Update tblRecipient
    DoCmd.OpenQuery "UpdRecipients(Merge)", acNormal, acEdit
    Else
    End If
    Else
    strFileName = CSTR_DOCSPATH & "BCPSOURCE.xls"
    DoCmd.OutputTo acOutputQuery, "Citco", acFormatXLS, strFileName, False
    Set objWord = GetObject(CSTR_DOCSPATH & "Citco.doc", "Word.Document")
    'set value to Date
    Set rstCitco = db.OpenRecordset("tblCitco", dbOpenDynaset)
    With rstCitco
    TDate = rst![tradedate]
    End With
    'Make word visible.
    With objWord
    .Application.Visible = True
    'Execute the mail merge.
    With .MailMerge
    .destination = wdSendToNewDocument
    .Execute
    End With
    Set appWord = .Application
    End With
    appWord.DisplayAlerts = wdAlertsNone
    objWord.Close
    appWord.DisplayAlerts = wdAlertsAll
    strFileName = CSTR_SAVEPATH & "CitcoFax" & Format(TDate, "DDMMYY") & ".doc"
    strMsgTitle = "Buttonwood Trade Administration System"
    vResult = Dir(strFileName)
    If vResult <> "" Then
    strMessage = "File " & strFileName & " already exists," & _
    vbCrLf & vbCrLf & "Would you like to overwrite that file?" & _
    vbCrLf & vbCrLf & "Click Yes to overwrite the file" & _
    vbCrLf & vbCrLf & "Click No to save the file with another name" & _
    vbCrLf & vbCrLf & "Click Cancel to return to the document without saving."
    vResult = MsgBox(strMessage, vbQuestion + vbYesNoCancel + vbMsgBoxSetForeground, strMsgTitle)
    Select Case vResult
    Case Is = vbYes
    With appWord
    .DisplayAlerts = False
    .activedocument.SaveAs filename:=strFileName, FileFormat:=wdFormatDocument
    MsgBox "Document has been saved.", vbInformation + vbMsgBoxSetForeground, _
    strMsgTitle
    .DisplayAlerts = True
    End With
    Case Is = vbNo
    strFileName = InputBox("File " & strFileName & " already exists," _
    & Chr(10) & "Please enter another filename not including " _
    & Chr(34) & ".doc" & Chr(34) & ": ") & ".doc"
    If strFileName = ".doc" Then
    MsgBox "You've clicked on cancel," _
    & " the document has not been saved.", vbInformation + vbMsgBoxSetForeground, strMsgTitle
    Else
    appWord.activedocument.SaveAs _
    filename:=CSTR_SAVEPATH & strFileName, FileFormat:=wdFormatDocument
    MsgBox "Document has been saved.", vbInformation + vbMsgBoxSetForeground, _
    strMsgTitle
    End If
    Case Else
    MsgBox "You've chosen not to save the document.", vbInformation + vbMsgBoxSetForeground, _
    strMsgTitle
    End Select
    Else
    With appWord
    .DisplayAlerts = False
    .activedocument.SaveAs filename:=strFileName, _
    FileFormat:=wdFormatDocument
    .DisplayAlerts = True
    MsgBox "Document has been saved.", vbInformation + vbMsgBoxSetForeground, _
    strMsgTitle
    End With
    End If
    AppActivate "Microsoft Word" ' Activate Microsoft Word.
    End If
    cleanup:
    On Error Resume Next
    Set objWord = Nothing
    Set appWord = Nothing
    Set rst = Nothing
    Set db = Nothing
    End Sub
    </pre>


    Edited by Charlotte to reduce horizontal scrolling

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: word from Access (access2000)

    OK, we can see what you're doing. One problem with this is that you aren't closing Word from it before you destroy the object variables. That means Word is going to be left open, whether that's what you intended or not, which is untidy and likely to cause you problems.

    Now, what exactly is it you're trying to do? You've already sent you fax or done the mail merge, so what is the purpose of activating Word?
    Charlotte

  7. #7
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    Ok, What Im doing here are as follows:
    Run the queries
    Merge document
    Output to new document
    Save document
    Allow user to view document (this is why word is activated so that user could edit or print report and do whatever with it.)
    <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: word from Access (access2000)

    But the user has *already* created the fax or mal merge. What are they going to do with it after that? It's already a done deal. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

  9. #9
    Lounger
    Join Date
    Apr 2001
    Location
    Khon Kaen, Thailand
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    Why don't you force the Word to maximize and use Message Box to block the process and keep the Word visible. Check it out at <A target="_blank" HREF=http://www.helptalk.net/forums/access/messages/156344.html>http://www.helptalk.net/forums/acces...es/156344.html</A>

    <font color=blue>...
    obj.WindowState = 1
    ...</font color=blue>

    HTH.
    Tim K.

  10. #10
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    Yes charlotte, you're right but I don't want to save the document as a merged document coz the data on these documents will change everyday that is why I sending all the data on the merged document to a new document and save it and then allow the user to open it. As you can see in the code the merged document is called Citco.doc and the new document created everytime I run the code is saved as citco followed by todays date.

  11. #11
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    No worries guys! I am sure the users will be able to close word and re open it.
    Thanx for trying.
    <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: word from Access (access2000)

    You lost me. Didn't you already save the created document , which *is* a merged document? You're creating a new file name and saving each one in the code.

    If you want to maximize Word, you should be able to do it like this when you first get started:

    ' Make Word visible and maximize
    objWord.Application.WindowState = wdWindowStateMaximize
    objWord.Application.Visible = True

    You might try appWord.Activate instead of AppActivate "Microsoft Word" at the end and see if that's any improvement.
    Charlotte

  13. #13
    4 Star Lounger
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    516
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: word from Access (access2000)

    Thanx Charlotte <img src=/S/bow.gif border=0 alt=bow width=15 height=15>
    Thats all I want to know.
    Have a HAPPY new year!
    <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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