I am automating a Special Order Form; adding a serial number, drop-downs, and text fields.
The working form and VB code is in “SOForm.DOT” which exists on our local file server.
We use Goldmine CRM to launch and populate automated documents with Company, Address, etc.
The goal:
1. Use Goldmine to launch the SOForm.DOT,
2. Populate the form with Customer data,
3. Save the form as “SOForm_#####.DOC,
4. Have the user populate the variable text fields, and a insert a picture, and
5. Save on exit.
Everything works in edit mode…
All of the code works when executed from the VBA editor.
The automated process fails because one of the first code operations is to save the file as a DOC which creates a new clean file with No VBA code.
The failure is isolated to the “Add Picture” code tied to a Button.
This is the code to save file:
ActiveDocument.SaveAs FileName:=”V:DocsSpecial Orders” & “SO_Quote_” & Format(SOquote, “00#”)
Side issue – This is the code to point the dialog box to the picture directory; doesn’t work.
ChangeFileOpenDirectory “W:Jewelry_Pix”
This is the code snippet tied to the “Add A Picture” button:
‘ \ Get a handle to the Insert picture dialog
Set oDialog = Dialogs(wdDialogInsertPicture)
‘ \ Work with dialog
With oDialog
‘ \ Display the dialog
.Display
Amplifications: The only piece broken is the “Add Picture” button/code.
A. In step 3, I immediately save the file as a doc to insure process integrity before the user gets a chance to make any changes.
B. In step 4, the user has an “Add Picture” button tied to the code above. This is the code that is missing from the DOC.
C. There are multiple users involved so adding code to Normal.Dot isn’t feasible.
D. There is an existing Goldmine directory for common documents; i.e., templates.
Questions:
How to I bind the button code that exists in “SOForm. DOT to the new DOCs?
Why doesn’t — work?
TIA,