Solved

Visual Basic/Word Question

Posted on 2000-03-16
14
187 Views
Last Modified: 2013-11-25
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
Comment
Question by:saksafon2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
14 Comments
 
LVL 4

Expert Comment

by:wesleystewart
ID: 2623898
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
 

Author Comment

by:saksafon2
ID: 2623972
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
 

Author Comment

by:saksafon2
ID: 2623983
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:wesleystewart
ID: 2624061
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
 

Author Comment

by:saksafon2
ID: 2624089
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
 
LVL 4

Expert Comment

by:wesleystewart
ID: 2624231
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
 

Author Comment

by:saksafon2
ID: 2624378
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
 

Author Comment

by:saksafon2
ID: 2624380
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
 

Author Comment

by:saksafon2
ID: 2624382
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
 

Author Comment

by:saksafon2
ID: 2624385
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
 
LVL 4

Expert Comment

by:wesleystewart
ID: 2624449
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
 

Author Comment

by:saksafon2
ID: 2624731
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
 
LVL 4

Accepted Solution

by:
wesleystewart earned 5 total points
ID: 2624776
I think so.  VBA keeps popping up everywhere-powerpoint, visio, autocad . . .

Wes
0
 

Author Comment

by:saksafon2
ID: 2625114
Meh.  Exciting.

rick
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio 2005 text editor 10 56
Protecting vb6 & .Net code Obfuscation 18 215
VS2015 Redefinition errors 4 105
Excel Automation VBA 19 116
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question