Results 1 to 11 of 11
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Word (Excel XP)

    Good Afternoon,

    I would like to know if there's a way to open WORD ( a specific Document really, "Acute.doc")

    Could someone point me in the right direction please?

    Thanks in advance.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Word (Excel XP)

    You can place a hyperlink to the document in a cell:
    - Select a cell.
    - Select Insert | Hyperlink...
    - Locate and select the file.
    - Click OK.

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Word (Excel XP)

    Thanks Hans,

    I appreciate your response. I currently have that solution. I however, was looking for a coding method for this. The reasoning is I have a spreadsheet that is used for an electronic manual and all is well. There are many worksheets and some which have hyperlinks to Word documents.

    However, when this manual needs to be printed. I have a page that has a button on it that when clicked, will print specific pages of the spreadsheet. (this code I already have). In keeping everything in order that it should be, I would like the ability to open the Word doc's that have the hyperlinks to them, print them also, and of course continue to print the pages in the workbook. That way when the entire manual is printed, everything is printed in the order that it needs to be in.

    Hope this is more clear....and again, thanks for the suggestion.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Word (Excel XP)

    See the thread starting at <post#=191651>post 191651</post#>.

  5. #5
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Word (Excel XP)

    Thanks Hans,

    That worked perfectly....as I mentioned in my post, I have several doc's I will be working with...so I tried to adapt the code to make many doc's print ... the following is what I came up with. It dies on the 1st Set oDoc statement....any suggestions?

    <pre>formatted text</pre>

    <pre>Dim oWd As Object
    Dim oDoc As Object
    Dim strAcute As String
    Dim strPsych As String
    Dim strWaiver As String
    Dim strOB As String
    Dim strCR As String
    Dim strDPU As String

    strAcute = "T:All_NHSNewtonAcute Notes.doc"
    strPsych = "T:All_NHSNewtonPsych Notes.doc"
    strWaiver = "T:All_NHSNewtonWaiver Notes.doc"
    strOB = "T:All_NHSNewtonOB Guidelines.doc"
    strCR = "T:All_NHSNewtonCR Screen Prints.doc"
    strCR = "T:All_NHSNewtonDPU Processess.doc"

    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets("Intake").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

    Set oWd = CreateObject("Word.application")
    Set oDoc = oWd.Documents.Open(Filename:=strAcute & strPsych & strWaiver & strOB & strCR)
    oDoc.PrintOut

    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets(Array("CR Down", "CR Wksht", "Aux-Que-LF", _
    "Review Type Listing", "Review Outline", "DPUs")).Select
    Sheets("Intake").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

    Set oWd = CreateObject("Word.application")
    Set oDoc = oWd.Documents.Open(Filename:=strDPU)
    oDoc.PrintOut

    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets(Array("VMailBox", "Staff Phone List", "CMA List", _
    "CPT Codes PS", "Medicaid Listings", "Terminology", "Area Codes", "Phone Nums", _
    "Phone Nums 2", "Passport", "Rx")).Select
    Sheets("Intake").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

    oDoc.Close savechanges:=False
    Set oDoc = Nothing
    oWd.Quit
    Set oWd = Nothing

    End Sub</pre>



    Again Thanks.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Word (Excel XP)

    You can open only one document at a time. So even if

    Set oDoc = oWd.Documents.Open(Filename:=strAcute & strPsych & strWaiver & strOB & strCR

    was correct syntax, it wouldn't work. As it is, you're trying to open

    T:All_NHSNewtonAcute Notes.docT:All_NHSNewtonAcute Notes.docT:All_NHSNewtonWaiver Notes.docT:All_NHSNewtonOB Guidelines.docT:All_NHSNewtonCR Screen Prints.doc

    You must open and print the documents one by one:

    oWd.Documents.Open(strAcute).Printout
    oWd.Documents.Open(strPsych).Printout
    ...

    Note: you set strCR twice; it should be strDPU the second time.

  7. #7
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Word (Excel XP)

    Good Morning,

    Ok....well....I've been working w/this code for some time now...w/o success....below is the current code I have ... it fails on the first opening of Word. The error msg I get is "Object Required"

    <pre>formatted text</pre>

    <pre>Dim oWd As Object
    Dim oDoc As Object
    Dim fNotActive As Boolean

    Dim strAcute As String
    Dim strPsych As String
    Dim strWaiver As String
    Dim strOB As String
    Dim strCR As String
    Dim strDPU As String


    strAcute = "T:All_NHSNewtonAcute Notes.doc"
    strPsych = "T:All_NHSNewtonPsych Notes.doc"
    strWaiver = "T:All_NHSNewtonWaiver Notes.doc"
    strOB = "T:All_NHSNewtonOB Guidelines.doc"
    strCR = "T:All_NHSNewtonCR Screen Prints.doc"
    strCR = "T:All_NHSNewtonDPU Processes.doc"


    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets("Intake").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

    On Error Resume Next
    Set oWd = GetObject(, "Word.Application")
    If oWd Is Nothing Then
    Set oWd = CreateObject("Word.Application")
    fNotActive = True
    End If

    On Error GoTo 0 ' or On Error Goto errorhandler if you have an error handler in this procedure
    Set oDoc = oWd.Documents.Open(strAcute).PrintOut
    Set oDoc = oWd.Documents.Open(strPsych).PrintOut
    Set oDoc = oWd.Documents.Open(strWaiver).PrintOut
    Set oDoc = oWd.Documents.Open(strOB).PrintOut
    Set oDoc = oWd.Documents.Open(strCR).PrintOut

    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets(Array("CR Down", "CR Wksht", "Aux-Que-LF", _
    "Review Type Listing", "Review Outline", "DPUs")).Select
    Sheets("CR Down").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

    On Error GoTo 0
    Set oDoc = oWd.Documents.Open(strDPU).PrintOut

    ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
    Sheets(Array("VMailBox", "Staff Phone List", "CMA List", _
    "CPT Codes PS", "Medicaid Listings", "Terminology", "Area Codes", "Phone Nums", _
    "Phone Nums 2", "Passport", "Rx")).Select
    Sheets("VMailBox").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True


    oDoc.Close SaveChanges:=False
    Set oDoc = Nothing
    If fNotActive Then
    oWd.Quit
    End If
    Set oWd = Nothing</pre>



    Could someone please help me w/this....what I'm trying to do is print a worksheet in the workbook, open some Word doc's, print them, return to the workbook, print a few more worksheets, open another doc and print it, then close all instances of Word.

    I've worked on this so long...I've confused myself more than I normally am...and that's a lot!.....PLEASE someone .... offer some suggestion!
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Word (Excel XP)

    Modify the code as follows:

    On Error Resume Next
    Set oWd = GetObject(, "Word.Application")
    If oWd Is Nothing Then
    Set oWd = CreateObject("Word.Application")
    If oWd Is Nothing Then
    MsgBox "Cannot open Word", vbExclamation
    Exit Sub
    End If

    fNotActive = True
    End If

    If you run the code now, do you get an error message "Cannot open Word", or still "Object Required"? If the latter, where exactly does it occur?

  9. #9
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Word (Excel XP)

    Afternoon Hans,

    I still get "Object Required" and it stops here:
    <pre>formatted text</pre>

    <pre>Set oDoc = oWd.Documents.Open(strAcute).PrintOut</pre>


    which is the same spot is was stopping at earlier.

    As always, thanks Hans.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Word (Excel XP)

    You're doing too much at once. Split the instruction into two:

    Set oDoc = oWd.Documents.Open(strAcute)
    oDoc.PrintOut

  11. #11
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Word (Excel XP)

    Thank You,

    All worked well....now maybe I'll get rid of this headache....
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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