Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error message when opening a .doc file using excel macro
Morning,
I have created a macro in excel that when the user clicks a "done" button a word document is opened from a shared drive. this is what i have so far: ------------------------------------ Dim x As String Dim wordApp As Object ThisWorkbook.Save x = Range("A156") Set wordApp = CreateObject("Word.Application") wordApp.Documents.Open "\\Flcscsrv02\share\Mercury Transactions\Test Docs\ " & x & "\Test word document.doc" ------------------------------------ when i run the macro the first time, nothing happens. when i run it a second time, i get the "File in Use" pop up. Where am i going wrong here? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200703/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error message when opening a .doc file using excel macro
Set wordApp = CreateObject("Word.Application")
wordApp.Visible = True -- Tim Williams Palo Alto, CA "GainesvilleWes via OfficeKB.com" <u32072@uwe wrote in message news:6f38f9987ede1@uwe... Morning, I have created a macro in excel that when the user clicks a "done" button a word document is opened from a shared drive. this is what i have so far: ------------------------------------ Dim x As String Dim wordApp As Object ThisWorkbook.Save x = Range("A156") Set wordApp = CreateObject("Word.Application") wordApp.Documents.Open "\\Flcscsrv02\share\Mercury Transactions\Test Docs\ " & x & "\Test word document.doc" ------------------------------------ when i run the macro the first time, nothing happens. when i run it a second time, i get the "File in Use" pop up. Where am i going wrong here? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200703/1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error message when opening a .doc file using excel macro
Hi
Try Dim x As String Dim wordApp As Word.Application Dim myDoc As Word.Document ThisWorkbook.Save x = Range("A156") Set wordApp = CreateObject("Word.Application") wrdApp.Visible = True Set myDoc = wordApp.Documents.Open "\\Flcscsrv02\share\Mercury Transactions\Test Docs\ " & x & "\Test word document.doc" myDoc.Activate regards Paul On Mar 15, 3:20 pm, "GainesvilleWes via OfficeKB.com" <u32072@uwe wrote: Morning, I have created a macro in excel that when the user clicks a "done" button a word document is opened from a shared drive. this is what i have so far: ------------------------------------ Dim x As String Dim wordApp As Object ThisWorkbook.Save x = Range("A156") Set wordApp = CreateObject("Word.Application") wordApp.Documents.Open "\\Flcscsrv02\share\Mercury Transactions\Test Docs\ " & x & "\Test word document.doc" ------------------------------------ when i run the macro the first time, nothing happens. when i run it a second time, i get the "File in Use" pop up. Where am i going wrong here? -- Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200703/1 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error message when opening a .doc file using excel macro
Thank you Paul & Tim.
Both ways worked! You guys are great =) wrote: Hi Try Dim x As String Dim wordApp As Word.Application Dim myDoc As Word.Document ThisWorkbook.Save x = Range("A156") Set wordApp = CreateObject("Word.Application") wrdApp.Visible = True Set myDoc = wordApp.Documents.Open "\\Flcscsrv02\share\Mercury Transactions\Test Docs\ " & x & "\Test word document.doc" myDoc.Activate regards Paul On Mar 15, 3:20 pm, "GainesvilleWes via OfficeKB.com" <u32072@uwe wrote: Morning, I have created a macro in excel that when the user clicks a "done" button a [quoted text clipped - 21 lines] -- Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200703/1 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200703/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
stop error message when opening a non existant file in a macro | Excel Discussion (Misc queries) | |||
Unnecessary error message on opening file with links | Links and Linking in Excel | |||
Error message opening Excel file | Excel Discussion (Misc queries) | |||
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. | Charts and Charting in Excel | |||
Error message when opening file | Excel Programming |