Solved

Visual Basic/Word Question

Posted on 2000-03-16
14
184 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
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

828 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