File in Use problem

I'm revisiting some VBS scripts that I wrote several years ago to generate 
resumes for me (via Word macros) and would like some guidance on a couple of 
errors I am getting. I'll post about the two errors separately so that each 
has its own thread.

My VBS script is pretty simple:

=======================
' Get arguments into variables
If WScript.Arguments.Count > 0 Then
 MsgBox "Too many arguments; expecting none."
 WScript.Quit
End If

' Find path for MyDocuments folder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(&H5&)
strMyDocPath = objFolder.Self.Path

' Start Word Application, open resume.doc in MyDocuments
Set oWd = CreateObject("Word.Application")
oWd.Visible = False
Set oDoc = oWd.Documents.Open(strMyDocPath & "\rhino-resume.doc")

'Run macro named createResumeFromFile, which has no arguments, and catch its 
return code
retcde=oWd.Run("createResumeFromFile")

'Save changes to doc on closing and quit Word
oDoc.Save
oDoc.Close
oWd.Quit
Set oWd = Nothing

Set objShell = Nothing

'Exit the script with the value of the return code from the macro/function. 
That will be zero from a successful execution or 1 otherwise.
wscript.quit(retcde)
=======================

When I execute this code, I get a message dialog saying:

==============
File In Use

 rhino-resume.doc is locked for editing by 'another user'.

Do you want to:
() Open a Read Only copy
() create a local copy and merge your changes later
() Receive notification when the original copy is available

[Ok] [Cancel]
================

Why am I getting this error? I'm pretty sure I don't have any other user 
accessing the file. This computer is a standalone machine with internet 
access; it is NOT a server. I'm running Windows XP SP2 and have one other 
user account on the computer but use it only VERY rarely.

I suspect this problem stems from a message I got several days back where 
Word offered something or another - I can't remember the context or message 
but it had something to do with saving a copy of the file - but I'm not 
sure. Also, I'm not sure what to do about it if I am right. How do I make 
Word understand that it can open the file with full read-write access and 
run the macro for me?

Since writing the macros and the VBS scripts, I've upgraded from Word 2002 
to Word 2007. I'm afraid I've forgotten quite a bit of what I was doing when 
I wrote the macros and scripts so I'm not sure if the upgrade is a factor or 
not relevant at all....

--
Rhino 


0
Rhino
2/23/2010 11:24:17 PM
word.vba.general 1023 articles. 1 followers. Follow

1 Replies
1123 Views

Similar Articles

[PageSpeed] 44

Sorry, please ignore this thread. I finally figured it out on my own.

It's funny how I often don't think of the solution until AFTER I've posted 
the question to a newsgroup or forum, even after giving it a lot of thought. 
It must be something to do with the process of describing the problem for 
someone else that finally clarifies it all in your brain....

--
Rhino



0
Rhino
2/23/2010 11:48:13 PM
Reply:

Similar Artilces:

saving publisher file to PDF file format #2
after creating a page in publisher i need to save it as a pdf file and send by email to a publishing house "Eddie" <Eddie@discussions.microsoft.com> wrote in message news:87A433B3-6EA5-439E-806D-74C985EA24DC@microsoft.com... > after creating a page in publisher i need to save it as a pdf file and > send > by email to a publishing house If you don't have Adobe Acrobat (not the Reader), download either of these: http://www.win2pdf.com or http://www.primopdf.com ...

How do I automatically prompt to file a sent message?
As a former NOTES user, I've become accustomed to being able to both send and file an email in "one" step. In Outlook the default is to file the sent item in the "sent" folder, or the folder in which the original message resides. I'd like the option of choosing any folder in which to file the sent message to come up automatically when I send an email. Any ideas? See http://www.outlookcode.com/d/code/setsavefolder.htm for sample VBA code to do this. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators,...

Migrating Office X files to Windows SBS 2k3
I have a situation with migrating some older Office X files to a new Windows Small-Biz Server 2003 environment. It seems that the person I am working with did not use the "Append file extensions" option when saving his Office X files on his Mac server (10.2.8). So now I have a situation where I need to move these extension-less files over to the Windows server but they will lose thier file associations. Is there anyway to save this extension "metadata" to convert these files on the Windows side? I have about 20GB of data to migrate and manually opening each file wi...

Using outlook express as newsreaedr from outlook
I have added the News command to the menu items of outlook, this is supposed to Open oulook express as the newsreader, however when I select news it opens a folder 1033 instead of Outlook express. How do I correct this problem? Thanks for any help Bob Answer has been posted countless times. To get the News command back, go back to the Programs tab in Control Panel | Internet Options and change the default newsreader to Outlook Express. If OE prompts you to make it your default newsreader the next time you launch it, clear the "Always perform this check..." box and then click the...

How to earase background of a Toolbar using OnEraseBkgnd method
Hi, How to Make the Toolbar transparent and color by using override OnEraseBkgnd of the Toolbar, paint it the color we want. Regards, sowmya. On Jul 21, 5:39=A0am, bhavana.sow...@gmail.com wrote: > Hi, > > How to Make the Toolbar transparent and color by using override > OnEraseBkgnd of the Toolbar, paint it the color we want. > > Regards, > sowmya. What is the problem in doing so? Are you not able to paint it correctly. Keep in mind that if you make it transparent, its going to show the color of underlying dockbar. -- Ajay ...

Inserting a file from FTP
Hello i have a FTP server that host's files for my office to share. >From one computer that has publisher 2000 on it has problems inserting a file from the ftp into a publisher document. The error i recive from that computer is that it has a problem linking a file that is not on the computer or on the network. The odd thing is that every other computer in the building can connect to the FTP and insert images from it. Also the computer can connect to the FTP through Internet Exlplorer so connectivity isn't a problem. Any help on this would be great. Also most the other computer'...

Duplicate File Message opening an Excel 97 file from Windows Expl.
When I open an Excel 97 file from Windows Explorer or the Documents menu of the Start button, the document opens, and I get a message that "A document with the name "XXXXX" is already open. You cannot open two documents with the same name, evan if the documents are in different folders." If I start Excel, firs, I don't get this message. Hi see: http://www.contextures.com/xlfaqApp.html#AlreadyOpen -- Regards Frank Kabel Frankfurt, Germany Mark B wrote: > When I open an Excel 97 file from Windows Explorer or the Documents > menu of the Start button, the ...

Excel File Association not working
Hi, One of our users cannot open an Excel file by just double-clicking on it any longer. If he opens Excel first, he can browse to the file and open it. I looked at the file associations for .xls types of files and it lists Excel as the program to use to open .xls. I tried an Office repair, but that didn't help. Can anyone tell me how to fix this? Thanks, Sandy M Sometimes one of these works for similar problems. Tools|Options|General|Ignore other applications (uncheck it) --- or --- Close Excel and Windows Start Button|Run excel /unregserver then W...

How to save a PC Excel file into MAC (it says file is read only)?
I am having troubles with an Excel workbook I created on my PC (using Excel 2000). Essentially I can't save it in a Machintosh computer. Thanks for your help ...

How to deal with empty element using ReadXML
below is a very simple XML file. I use ReadXml to read data. When it reaches an empty element as <Product /> below, my program crashes. The error: System.NullReferenceException: Object reference not set to an instance of an object. How can I assign a value to this empty element? Thanks Bill --------------------- - <Inventory Type="Physical"> <Product /> <TankNumber>0031022207-1</TankNumber> <UserDefinedTag>0</UserDefinedTag> <DateTime>2007-07-11T03:52:00</DateTime> <Volume>0</Volume> <Ullage>1...

How to convert binary file to ASCII file
How to convert binary file to ASCII file? Thanks in advance! "prinz" <de6666@lycos.com> wrote in message news:40222AF5.B3B6EFFB@lycos.com... > How to convert binary file to ASCII file? > > Thanks in advance! > well, an ascii file is a binary file... just the bits happen to be easily displayable as letters, number, and other symbols. you will have to find out what the meaning of each bit in the binary file is, how the bits are grouped into bytes, and how the bytes are grouped into higher order things. then read the file with the appropriate file access method a...

OL2003 Attachment Problems
Hi, a custumer experiences the following problem within his network (w2k3 server, XPSP1 clients) with regard to outlook and attachments: The mail in question is a mail with a rar-compressed attachment: If the same mail goes to a workstation with OL2002(SP3) installed, everything is perfect, but on the workstations with OL2003 (SP1) installed, the mail seems to be "empty". That is: no "from", no "to", no "subject" and no attachment. In the body only one line shows up, which seems to be the header of the rar-attachment. Even changing the extension ...

Trying to Open Excel File, But its says file is locked for editing
I'm trying to open an Excel file on a network drive. However when I try to open it. It has an Error Message: File in use. Drivers return 'Taco far return disk Chart 2005.xls' is locked for editing. Options are 'Read Only', 'Notify' or 'Cancel' I know no one is in the spreadsheet, and does not indicate who would be if there was. Can anyone help? Maybe: http://contextures.com/xlfaqApp.html#ReadOnly or http://contextures.com/xlfaqApp.html#AlreadyOpen Both from Debra Dalgleish's site. Smeeta Geary wrote: > > I'm trying to open an Exc...

problems with inserting html to xslt file.
Hi, I have a string/xml value that has to be inserted to a specific <xsl:tempalte> tag, I have a namespace registered so that I can insert new XSL elements. nsmgr = New XmlNamespaceManager(myXslt.NameTable) nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform") This is the string that has to be inserted to xsl:template tag : <tr> <td><xsl:apply-templates select="bla" /></td> </tr> If I try the element.insertXml method there is an error saying undeclared namespace and poiting to the <xsl:apply> tag. The...

Those damn pst files!!
Hello, I have had MANY problems with outlook, first, I had problems where I had to reinstall every time I closed outlook xp or I couldn't send emails, then I tried the detect and repair--restore defaults, then I reconfigured and it seemed to work fine...EXCEPT I could no longer intellisync or sync anything...I looked into the matter, and found that my default Outlook.pst was now outlook1.pst, so I changed the name to outlook.pst, reconfigured (again lost the address book in the process) and still can't sync...what is up with these damn pst files? WHERE should I put that OUTL...

Storing strings in header file via resource file (.rc file) ?
Hi: My application needs to support multiple languages. I'm now planning to strong strings in multiple string tables in the rc file; where each string table contains one language. My question is: will it be much simpler to store those strings in multiple header files? In this case a string can be used directly without the need to use CString to load each string before using it. Please let me know if I'm missing some advantages using the rc file to store strings. Thanks in Advance. Polaris "Polaris" <etpolaris@hotmail.com> wrote in message news:<e...

How do I use Goal Seek?
i'm not quite sure how to use goal seek .. can anyone help me? Sure we can help. Bur what's the problem you want to solve? -- Kind Regards, Niek Otten Microsoft MVP - Excel "Brianne" <Brianne@discussions.microsoft.com> wrote in message news:89542242-B37E-42E7-9165-E6C50423E47C@microsoft.com... > i'm not quite sure how to use goal seek .. can anyone help me? > > i'm not quite sure how to use goal seek .. can anyone help me? Here's an simple example. Suppose to want to calculate the square root of the number in A1. In A3, put =A2...

Can i import one excel file to another excel file?
I have a new excel file that I want to update with an older excel file, can I import the two? There must be an easy way to merge the two together without having to retype. Depends on what you mean by update. If it's just to add more data to the bottom of an existing list, open both files, then select the data, Edit/Copy it and Edit/Paste to the other workbook. If that's not what you want, can you be more specific? On Thu, 14 Oct 2004 20:59:09 -0700, "kimbers867" <kimbers867@discussions.microsoft.com> wrote: >I have a new excel file that I want to update with ...

Problem converting Quicken backup file to Money 2004
Hi, When I use the Converting Quickent Files feature, after the conversion is done, it shows the correct balance in the Quicken balance, but on the Money balance column, it's all zero. After conversion, I open the converted Money file, all accounts still show zero balance. What's the correct way to import all Quicken accounts and balance to Money? thp ...

OL 2002 - Attached MSG file - No body property returned
We have a large number of psts with emails bearing problematic MSG attachments. The PST files appear to be from an Exchange environment (Likely 2000). We are using VB6 to access the data via Outlook 2002 (we've tried 2003, but with the same results). Outlook 2002 (sp-2) is not returning any value for the body property of an attached MSG email items. When opening them in Outlook, you can see that there is in fact body text which seems only to be visible when viewed through the UI in OL. Here is something odd: 1. When viewed in Quick View Plus (ver 6 & 8) it appears with only the heade...

Problems with CreateFile
Hi, I want to write a file using the code given below. In very rare cases the file-contents are not changed but the last modified date is set to the current date. What is wrong here? I use this code on a WinXP Prof. The file I want to write already exists. But it is NOT write protected. I have full-rights access (adminstrator) Any ideas`? if ((fileHandle = CreateFile(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH, NULL)) == INVALID_HANDLE_VALUE) { // error handling bla ... } ...

opening .wks files
Had created spreadsheets as .wks files on Windows ME. I'm unable to open these now that I've upgraded to XP and Office XP. I've tried to associate them with Excel but they will not open properly. How can I retreive these? Hi a repost from Ken Wright to convert MS Works files: ----- Generally you would normally open the file in WORKS and then save it down as a file that Excel can read. .xlr is a native Excel format, or .txt, ..csv, dbaseIV are all formats it can read. You can also find a converter here if you don't have WORKS. http://www.rl-software.com/indexjs.htm?/con...

Converting a file Money 2001 --> Money 2005 Help!!
Hi, I've downloaded the trial for Money 2005 Deluxe. I was previously using Money 2001 (standard). I get an error --------------------------- Microsoft Money --------------------------- Money cannot open this file because it was created by an incompatible version. --------------------------- OK --------------------------- I've tried renaming the file and opening as someone suggested on the group somewhere which I couldn't get to work. So I downloaded the 2004 trial and converted it to 2004 which worked ok. I then tried to upgrade my new 2004 file to 2005 which failed again....

How do I configure Outlook to use a set email for a certain recipient
Hello, Is it possible to set Outlook 2003 in a way (either with rule or some other method) that it uses a set email address for a certain recipient? Let me clarify it. I have 2 different email accounts: one for work and for personal stuff. When I email to my friend -whose email address is stored in my address book - I want outlook to use my personal email address, even though my work email address is set as the default one. Is it possible with a rule, or some other way? I couldn't find any info on the net. Thanks, Zee Not in any current Outlook versions, no. --� Milly Staples [MVP ...

File in Use
I am using Excel 2002 XP - SP2 When I go to open up the workbook 'money' I get the following message pop up: File in Use money.xls is locked for editing by Bill Chatfield there are 3 buttons on the right of the message box read only notify cancel I have no idea why it started doing this a few days ago. I have been using this workbook for years. I check the properties and it is not 'read only' or 'hidden' and once I re-boot it will open fine and then for no apparent reason I get the above message again. The only thing I can think of that MIGHT be related to this ...