Solved

Visual Basic/Word Question

Posted on 2000-03-16
14
180 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

914 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now