Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Word 2007 macro in Word 2010

Status
Not open for further replies.

shedlord2

Technical User
May 20, 2006
36
GB
Hi,

We have a CRM system, one function of which is to generate custom letters in Word using macros (they drag customer details into templates). Am just setting up PCs with Office 2010 for the first time and found the macros we have for Word 2007 don't work in Word 2010. The dialog box error is "this file could not be found". The portion of the macro brought up in the debugger is below, with the highlighted line it chokes at below.

I've read that Word 2010 is fully compatible with 2007, but wondered if that doesn't apply to Macros? Any clues what may be the cause?

Yes, I have raised it with the CRM supplier, but it may take some time for us to achieve support from them and I really need to resolve this within the next couple of days. Thanks in advance for any suggestions.

---

Private Sub NewForm()
Dim fn$
Dim pn$
Dim Title$

'   On Error Goto Trap

Dim FileInfo As Object: Set FileInfo = WordBasic.DialogRecord.FileSummaryInfo(False)

    WordBasic.CurValues.FileSummaryInfo FileInfo
'   dot$ = FileInfo.Template
    fn$ = FileInfo.FileName
    pn$ = FileInfo.Directory
    Title$ = FileInfo.Title

    Dot$ = pn$ + "\" + fn$
    WordBasic.DocClose 2

    WordBasic.FileNew Template:=Dot$, NewTemplate:=0
    If Title$ = "" Then Title$ = "New Merge Document"
    WordBasic.FileSummaryInfo Title:=Title$
    'Setting title sets DocumentDirty to true
    WordBasic.SetDocumentDirty 0

bye:

End Sub

---

It highlights this line in the debug window...

WordBasic.FileNew Template:=Dot$, NewTemplate:=0


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top