Word 2007 will not save work

  chalkie 11:24 18 Apr 2009
Locked

Hi, after a workmate entered some visual basic code in word, in order to enable a word doc to be sent via outlook 2007, I get an error on starting word, a vb box with file not found, click ok, then word opens, however it will not save anything.

Any changed docs, when asked if you want to save changes, click yes, nothing happens, click no it closes down, obviously without the changes. It will not save new docs either.

I cannot find the vb he did, although it does show up as a macro, which it is, but will not run, allow any edits etc. I cannot delete it either. All the permissions are correct the macro is signed etc. He cant/wont help as he says it works ok on his machine!

Thanks in advance.

  OTT_Buzzard 11:43 18 Apr 2009

If you go in to word and press Alt + F11, that will bring up the VB editor window.

IF you can go through and copy / paste the code in to the forum I may be able to help. Hard to tell without knowing what the code is though.

Buzz

  tasslehoff burrfoot 12:14 18 Apr 2009

If the edit option is greyed out, sounds like the VBE is password protected so you may need to get the password from your unhelpful workmate.

I'm astonished anybody would write some code and then not maintain it "because it works for me"

  chalkie 12:16 18 Apr 2009

When I go into the editor window it is blank nothing is there. When he created the thing, he was able to use Insert>Module, etc to start, that is now grayed out.

I have a version of the script below. Not sure if its origin though I know it is not his. I did work the first time he tried it, but not since word was shut dow and restarted.

Sub SendDocAsMail()

Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem

On Error Resume Next

'Start Outlook if it isn't running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
End If

'Create a new message
Set oItem = oOutlookApp.CreateItem(olMailItem)

'Allow the user to write a short intro and put it at the top of the body
Dim msgIntro As String
msgIntro = InputBox("Write a short intro to put above your default " & _
"signature and current document." & vbCrLf & vbCrLf & _
"Press Cancel to create the mail without intro and " & _
"signature.", "Intro")

'Copy the open document
Selection.WholeStory
Selection.Copy
Selection.End = True

'Set the WordEditor
Dim objInsp As Outlook.Inspector
Dim wdEditor As Word.Document
Set objInsp = oItem.GetInspector
Set wdEditor = objInsp.WordEditor

'Write the intro if specified
Dim i As Integer
If msgIntro = IsNothing Then
i = 1
'Comment the next line to leave your default signature below the document
wdEditor.Content.Delete
Else
'Write the intro above the signature
wdEditor.Characters(1).InsertBefore (msgIntro)
i = wdEditor.Characters.Count
wdEditor.Characters(i).InlineShapes.AddHorizontalLineStandard
wdEditor.Characters(i + 1).InsertParagraph
i = i + 2
End If

'Place the current document under the intro and signature
wdEditor.Characters(i).PasteAndFormat (wdFormatOriginalFormatting)

'Display the message
oItem.Display

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
Set objInsp = Nothing
Set wdEditor = Nothing

End Sub

  OTT_Buzzard 12:18 18 Apr 2009

I'm astonished anybody would write some code and then not maintain it "because it works for me"

Seems a bit odd - bizarrely i quite like it when code works on my PC but not someone else's - it means i've missed something and need to learn!

  tasslehoff burrfoot 12:23 18 Apr 2009

I don't see anything wrong with that code.

Certainly not anything that would cause the issues you have.

Can you have a look in the open and beforesave events, see if there's anything in them?

  OTT_Buzzard 12:29 18 Apr 2009

Is the script supposed to work with any document, or does it relate to a specific document?

The script given looks like it's for Word 2003? Not sure it would work for a higher version or for a version less than Word 2000.

IF the file doesn't contain any sensitive information, then it may be easier for you to mail me the original doc - it sounds like the VBA code is password protected (not usually a major problem!)

If you don't mind doing that then click on the envelope next to my name and I will reply with my personal email address.

  OTT_Buzzard 12:37 18 Apr 2009

there's nothing in the script above that would prevent work from being saved!

  chalkie 12:45 18 Apr 2009

I cannot look in the code at all the vbe is blank. Is is supposed to run as a macro and indeed does show up in the macros from the developer tab, but will not run nor will it allow any edit or delete.

When trying to press edit the box closes and nothing elsr happens, when I delete it it goes but as soon as you look again int he nacris section it is still there.

It is supposed to work with with any document, I am not sure but when it was entered it was a blank doc, I think, if not I think I might know which doc was open at the time. Could that make a difference?

I am waiting to hear from him as to where the script came from. I have seen it work and have had no problems with word prior to this.

  chalkie 12:51 18 Apr 2009

Just as I posted he sent me an email. The script comes from:

click here

It was saved to 'normal.dotm' he tells me so as to work with any document.

  VoG II 12:52 18 Apr 2009

If it is happening with any document then maybe the macro is stored in the default template normal.dotm

Try closing word, search for normal.dotm (you will need to search for hidden files) then rename it to normal.old and start Word.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

WPA2 Hack Latest News: How Secure is your Wi-Fi?

Photoshop CC 2018 released with new Curvature Pen and better brush tools

Best kids apps for iPhone & iPad

Comment utiliser Twitter ?