BlueDNA
12-04-2005, 06:28 PM
Hi guys,
I'm very new to VBA and the forum so please be nice! :hi:
Coming from an OOP background and now im asked to do some VBA stuff its all very scary! I've gone pretty far all alone, but ive run into a problem and ive google'd everywhere but havent found a solution yet.
Essentially what im trying to do is create a macro (Menu.dot) that:
- Prompts the user for a document type (i.e. Letter, Memo, Minutes, etc) that they would like to create (through a series of menus)
- Accepts the relevant generic input data (i.e. To: Firstname, Surname, etc, CC: firstname, surname, etc)
- Writes the input data into a temp text file.
- Then from the template file open another template file (from Menu.dot->Letter.dot) which has a macro to read data in from the temp text file and map them into the bookmarks on that template file.
- Save the document as a new .doc file (i.e. NewLetter.doc)
- Then close.
Pretty sexy stuff, but im having one little problem. I've basically achieved everything except being able to open another template from a template file.
When i open another template file using: Document.Open("Letter.dot")
it only opens the file and does not trigger the macro to read in the data from the temp text file. Using something like:
Dim w As Object
Set w = CreateObject("Word.Basic")
w.AppMaximize
w.FileOpen "Letter.dot"'
Set w = Nothing
The aboove method does the same thing, However when i double click on Letter.dot, the macro is launched and does everything i want it to do (autonew() launches and reads the temp text file and populates the bookmarks, saves and closes.)
Im hoping its not a big task to get this missing link. If anyone can help or provide a work around i would really really really appreciate it!!!
Thanks in advance!
BlueDNA :hi:
I'm very new to VBA and the forum so please be nice! :hi:
Coming from an OOP background and now im asked to do some VBA stuff its all very scary! I've gone pretty far all alone, but ive run into a problem and ive google'd everywhere but havent found a solution yet.
Essentially what im trying to do is create a macro (Menu.dot) that:
- Prompts the user for a document type (i.e. Letter, Memo, Minutes, etc) that they would like to create (through a series of menus)
- Accepts the relevant generic input data (i.e. To: Firstname, Surname, etc, CC: firstname, surname, etc)
- Writes the input data into a temp text file.
- Then from the template file open another template file (from Menu.dot->Letter.dot) which has a macro to read data in from the temp text file and map them into the bookmarks on that template file.
- Save the document as a new .doc file (i.e. NewLetter.doc)
- Then close.
Pretty sexy stuff, but im having one little problem. I've basically achieved everything except being able to open another template from a template file.
When i open another template file using: Document.Open("Letter.dot")
it only opens the file and does not trigger the macro to read in the data from the temp text file. Using something like:
Dim w As Object
Set w = CreateObject("Word.Basic")
w.AppMaximize
w.FileOpen "Letter.dot"'
Set w = Nothing
The aboove method does the same thing, However when i double click on Letter.dot, the macro is launched and does everything i want it to do (autonew() launches and reads the temp text file and populates the bookmarks, saves and closes.)
Im hoping its not a big task to get this missing link. If anyone can help or provide a work around i would really really really appreciate it!!!
Thanks in advance!
BlueDNA :hi: