Office 2007 is not easy for me! Help?

D

Danny Boy

I'm having a heck of a time getting used to Office 2007 (primarily the
changes in Excel and Word). I have an Excel Spreadsheet with a macro that
allows me to access a drop down menu of student names. When I select a name,
a Userform pops up, which I can input comments into. The code allows "Excel"
to call up "Word". With Office 2002, this works just fine, however with
Office 2007, it won't work. It would appear that the macros and code imbedded
into Excel work on all Excel focused items, however, this interaction of
Excel and Word will not work, leading me to believe that it is something that
needs to be altered in Word (versus Excel).

I've tried all the obvious (making sure macros and VBA coding are turned on,
and made sure to place the relevant information in "Normal" versus" Project.
Thanks for any help........Best, Dan

Here is the relevant code if it would be of assistance in figuring out my
problem:

The Excel Code in Module 2 is:

Sub show_Comments()
UserForm3.Show vbModeless
End Sub
Sub CallWord(parm1)
'************************************************************************
' Call WORD from Excel
'************************************************************************

Dim MyWord As Object
On Error Resume Next

Set MyWord = GetObject(, "Word.Application")
If Err Then
Set MyWord = CreateObject("Word.Application")
End If

MyWord.Application.Visible = True
MyWord.Application.Activate

APPNAME = parm1 & ".doc"

pathname = Range("RootDir") & APPNAME

Set MyWord = GetObject(pathname)

If Err Then Set MyWord = CreateObject(pathname)

With MyWord
' .Application.Visible = True
.Application.Run "UpdateComments", pathname
.Application.Quit 'Quit Word
End With

Set MyWord = Nothing
End Sub



And the Word Code (in Module 1) is:

Sub UpdateComments(parm1)
'
' parm1 = File path

On Error Resume Next

Documents.Open FileName:=parm1

If Not FileExists(parm1) Then ' Check if file/folder exists .....

MsgBox "File " & parm1 & " does not exist", vbOKCancel
Exit Sub
End If

UserForm1.Show

End Sub
Function FileExists(fname) As Boolean
' Returns TRUE if the file exists
Dim x As String
x = Dir(fname)
If x <> "" Then FileExists = True _
Else FileExists = False
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top