Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
|
|||
|
|||
![]()
I have worked with this for many months, and just when I think it's good it
gives me more problems! The macro is in an Excel workbook. It takes the file name from the ActiveCell and the file path from the workbook's path, and opens a Word document in the same folder as the workbook. All docs listed in the workbook do exist in that folder. Most of the time it works fine. All too often, though, it opens an instance of Word but not the doc. Yesterday was especially bad - after running around this circle several times, I closed all programs and went to the folder to open the doc directly. There was a "ghost" of the doc (ghosted icon with "~name.doc"). I checked Task Manager and yep, there was a Word instance still running. I terminated that and killed the ghost file. But now I'm leery of running this macro. As additional info, I use Outlook with Word as email editor, and occasionally open a Word toolbar to access a Word macro while composing an email. That was my situation yesterday when the first crash happened, but it kept happening after several Restarts and Shutdowns. If anyone has any ideas, I'd be more than happy to hear them. Ed Sub FindDoc() 'Dim WD As New Word.Application Dim WD As Object Dim doc As String Dim Fname As String Dim Fpath As String Err.Clear ' Get file path Fpath = ThisWorkbook.Path Sheets("Sheet1").Activate ' Get doc name from list page Fname = ActiveCell.Text ' Open doc doc = Fpath & "\" & Fname & ".doc" On Error Resume Next Set WD = GetObject(, "Word.Application") If Err.Number < 0 Then Set WD = CreateObject("Word.Application") End If Err.Clear On Error GoTo 0 WD.Documents.Open doc WD.Visible = True Set WD = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Excel file from VB and open MACRO | Excel Discussion (Misc queries) | |||
open up an excel program with an auto open macro | Excel Programming | |||
Macro - Open Word with Excel macro | Excel Discussion (Misc queries) | |||
ASP: Open Excel File with Macro, Allow Macro to run, and then save | Excel Programming | |||
How do I get my personal macro worksheet to open whenever I open . | Excel Discussion (Misc queries) |