Deleting autotext from normal.dotm

L

Laurel

I'm not a VB programmer, but I need to fix a VB DLL to be compatible with
Word 2007. Below is the code I've got, and a suggestion from a colleague
about how to fix it. But his suggestion won't compile. Can anyone give me
the proper syntax? I'm working in vb6, and the code is used to create a
DLL.



Note - before I put the 2/09 change in, we got the error "file not found."
After the change, we get the error "Command failed."



Note also - I see that this group is for VBA, not VB6, but it's oriented to
Word, and it seems as if Word is more relevant. But let me know if I should
re-post in the VB.General group.





'Remove the Autotext entry from NORMAL.DOT

'WordApp.OrganizerDelete Source:="Normal.dot", _ LAS-2/09-for Word 2007

WordApp.OrganizerDelete Source: =Normal.dotm", _

Name:=Current_AutoText, Object:=wdOrganizerObjectAutoText



This probably needs to look something like this (from a quick word 2007
macro):



WordApp. NormalTemplate.BuildingBlockEntries(Current_Auto_Text)Delete



THIS WON'T COMPILE
 
J

Jay Freedman

Laurel said:
I'm not a VB programmer, but I need to fix a VB DLL to be compatible
with Word 2007. Below is the code I've got, and a suggestion from a
colleague about how to fix it. But his suggestion won't compile. Can
anyone give me the proper syntax? I'm working in vb6, and the
code is used to create a DLL.



Note - before I put the 2/09 change in, we got the error "file not
found." After the change, we get the error "Command failed."



Note also - I see that this group is for VBA, not VB6, but it's
oriented to Word, and it seems as if Word is more relevant. But let
me know if I should re-post in the VB.General group.





'Remove the Autotext entry from NORMAL.DOT

'WordApp.OrganizerDelete Source:="Normal.dot", _ LAS-2/09-for Word
2007
WordApp.OrganizerDelete Source: =Normal.dotm", _

Name:=Current_AutoText, Object:=wdOrganizerObjectAutoText



This probably needs to look something like this (from a quick word
2007 macro):



WordApp. NormalTemplate.BuildingBlockEntries(Current_Auto_Text)Delete



THIS WON'T COMPILE

It's a syntax error. The Delete method is a member of the BuildingBlockEntry
object returned by the expression .BuildingBlockEntries(Current_Auto_Text)
so you need a dot before the Delete. You also need to remove the space (if
it's really there) after WordApp.

WordApp.NormalTemplate.BuildingBlockEntries(Current_Auto_Text).Delete

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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