Re: Basic macro questions
Quote:
Can I make a makro that opens a template and edit it? (without having to open the template before running the macro)
Yup. Check the intellisense/help on Documents.Open or Documents.Add methods.
Quote:
How can I decide exactly where I want to put the text? I know how to move the selection but that depends on where the cursor was right? I want to set an absolute position.
Word works like Excel using ranges. Only Words ranges are characters from the start of the doc (or section or table/paragraph etc).
You could use a find and replace, putting in (for example) '(token01)' (without single quotes) to find an then your code can replace with whatever is typed in. Or you can store specific position(s) in the doc to add to. Or you can find a bookmark and add after that.
Easiest is to record a macro of what you want, then change the code as you need. Especially on the objects used (ie try to stay away from the selection object).
Re: Basic macro questions
Welcome to the Forums.
You will need a document or template document that consists of this UserForm.
You can create a new document off off of it or another template and in this document/template you would have bookmarks where you need to insert your text from the UserForm.
For help on recording a macro see my FAQ - http://vbforums.com/showthread.php?t=402032
This will help you see how word codes the actions you desire. ;)
Re: Basic macro questions
Thanks. How can I avoid using the Selection object (when I record a macro, that object is used). Right now Im using bookmarks. But how can I store a certain position (I would really like to store a position and draw a line from that)