Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

Visual Basic/Word Question

I don't even know if this is possible but it sure would be nice if it was.
I want to place a statement at the top of the form to automatically set each line in a word document up to a certain amount of spaces and automatically set up where pages are and such so I can insert things on a coordinate basis.  Is this possible in Word VB?

rick
0
saksafon2
Asked:
saksafon2
  • 9
  • 5
1 Solution
 
wesleystewartCommented:
Welcome back!!

You will find that EVERYTHING is possible if you take the time to figure out how to get it to work.  Of course, the value you add by coding some process might not offset the 100 hours you put into it, but that's for you to decide.

Can you describe in more detail what you're trying to accomplish?

Wes
0
 
saksafon2Author Commented:
I'm back, I'm back.  *takes a bow*

I want to be able to look VB in the eye and say, "Hey, put this line of text on line 40, column 30."
I want it to go there.  I want to be able to say "Go to line 62 and place a section break."  I can put a "selection.movedown unit:=wdline, count:=62" but because there are not <CR>'s all the way down the page it doesn't go anywhere except to the end.  

MEH.

rick
0
 
saksafon2Author Commented:
I'm back, I'm back.  *takes a bow*

I want to be able to look VB in the eye and say, "Hey, put this line of text on line 40, column 30."
I want it to go there.  I want to be able to say "Go to line 62 and place a section break."  I can put a "selection.movedown unit:=wdline, count:=62" but because there are not <CR>'s all the way down the page it doesn't go anywhere except to the end.  

MEH.

rick
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
wesleystewartCommented:
Is this something you can accomplish by creating a new template full of carriage returns and then using it to create new documents?

If you need to do the same task over and over, you might just want to create a document, put the text in the funny places, and then save it a a template (.dot) so you can use it again and again.

Or, on opening the document you could execut a line of code like:

Document.Body = Space(1000) which will give you 1000 spaces.  That ought to be worth a few pages.

We can figure out how to accomplish whatever it is, but it might be complicated.

Wes
0
 
saksafon2Author Commented:
That space sounds good.. is there a way to select one line?  Say "selection.goto.line(32)"?
That'd be nice but it doesn't work.
0
 
wesleystewartCommented:
That would be:

Selection.MoveDown unit:=wdline, count:=32

to move the selection start point to the beginning of line 32.  Then:

Selection.MoveEnd Unit:=wdLine, Count:=1

would move the selection end point to the end of the line, effectively selecting the entire line.

Wes
0
 
saksafon2Author Commented:
What if I want to move the cursor to line 32 and there are only 20 lines on the document done already?  It'll stop on 20 and stay there.. it won't create the rest..

rick
0
 
saksafon2Author Commented:
What if I want to move the cursor to line 32 and there are only 20 lines on the document done already?  It'll stop on 20 and stay there.. it won't create the rest..

rick
0
 
saksafon2Author Commented:
What if I want to move the cursor to line 32 and there are only 20 lines on the document done already?  It'll stop on 20 and stay there.. it won't create the rest..

rick
0
 
saksafon2Author Commented:
What if I want to move the cursor to line 32 and there are only 20 lines on the document done already?  It'll stop on 20 and stay there.. it won't create the rest..

rick
0
 
wesleystewartCommented:
you might want to stop hitting Refresh on your browser . . .  Use the 'reload question' near the top-right corner of the EE page.

You'll have to make sure your document already has those lines.  Use a template:

Take a blank document.  Add a lot of space to it, maybe by hitting <Enter> about a thousand times.  Save this document with a '.dot' suffix.  That makes it a template.  When you need to create one of your "special" documents, open a new document based on this template.  It will have pages and pages of space for you to work with.  The problem with this approach is that while you edit the document you will be adding and subtracting characters. which will throw off your spacing, but you'll have to find a way around that.

What, may I ask, is your application?  You might be better off with a forms-generation package or by just using userforms rather than documents.  They are printable and everything will appear right where you want it.  Maybe Msoft Publisher would be a better piece of software for you . . .

Wes
0
 
saksafon2Author Commented:
I'm not hitting refresh at all; whats happening is the system is stopping connection and forcing me to hit submit again.  I'm on a slow slow connection.  I'm working at the Third Judicial Circuit Court of Detroit as a temporary right now doing typing and now, for the first time in a long time, programming to make the development of reports and informational sheets much much quicker than doing it by hand.  I never thought of looking into Publisher;  I don't have it on this system but maybe I could acquire it.  It's not really a form--the file is more of a document, but I need certain things in certain places.  Hm!  Maybe I'll take a look into publisher if I can get it loaded up on this system.  I'm assuming Publisher has a built in VB as well?

-rick
0
 
wesleystewartCommented:
I think so.  VBA keeps popping up everywhere-powerpoint, visio, autocad . . .

Wes
0
 
saksafon2Author Commented:
Meh.  Exciting.

rick
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 9
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now