Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stop error message when opening a non existant file in a macro swar phil Excel Discussion (Misc queries) 1 March 22nd 10 02:35 PM
Unnecessary error message on opening file with links Dan H Links and Linking in Excel 0 December 12th 08 10:58 AM
Error message opening Excel file Mark Excel Discussion (Misc queries) 0 February 6th 08 04:43 PM
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. Tim Marsden Charts and Charting in Excel 2 October 15th 05 02:10 PM
Error message when opening file Chrissy Excel Programming 1 December 22nd 04 05:51 PM


All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"