PDA

View Full Version : Word Constants



Movian
10-20-2008, 08:22 AM
Hey,
i don't know about you guys but I'm using Late binding and i get really annoyed when I'm looking for some code and when i find some they have used the Word reference constants!!! meaning i then have to go hunting for the value to setup etc.

Well i found the ENTIRE list of word constants for word 2003 (the MSDN didn't have 2007 :( ) and i took the time and effort into taking these values and i converted them into a bas file that you can import into your access (and i presume other VBA compatible programs) to make use of these constants without having to look up the values each time.

I have done some minor testing but any problems etc please let me know and i will be more than happy to make corrections.
:beerchug:
My next project is to figure out how to get some kind of Intellisense working with Late binding but i have yet to have an idea about going about this

Demosthine
10-20-2008, 10:09 AM
Morning Movian.

I feel your frustration and found myself making modules like that for many of the different reference I was using. It definitely makes life much easier.

In regards to your IntelliSense with Late Binding, I find it highly doubtful you'll manage that, but if you do, I'll give you lots of kudos and make you my new best friend. I'd even pay money for that.

I try to use Late-Binding as well if the project is going to go anywhere other than to myself. It eliminates so many problems with Version conflicts.


I find that it is easiest to write everything using Early Binding. Then you automatically have access to IntelliSense. Then, the only things you have to do (assuming you have a list of constants like this), is to change your declaration lines from the Object's Class (Word.Application) to Type Object and add a new line for Set = New ...

That seems to work fairly well and I just add in the Late-Binding Code while I'm typing. I have it commented until I'm ready to switch for Early to Late.

What would be really nice is have an add-in that will read the entire project and switch the comment marks for you. For example...

Convert from:

' Early Binding Start
Dim appWord as Word.Application
Set appWord = New Word.Application
' Early Binding End
' Late Binding Start
' Dim appword as Object
' Set appWord = CreateObject("Word.Application")
' Late Binding End

To:


' Early Binding Start
' Dim appWord as Word.Application
' Set appWord = New Word.Application
' Early Binding End
' Late Binding Start
Dim appword as Object
Set appWord = CreateObject("Word.Application")
' Late Binding End


Food for thought.
Scott

Movian
10-22-2008, 08:01 AM
Hmmm i am unsure about this but could i post this in a KB article to make it a little more permanent ? I mean I'm not sure on the process or if it is what it is meant for...

i mean if i need to i guess i could broaden it to Office Constants and speak about the Constants in general then supply the file at the end as a starting point.

can anyone advise me on this ? Thanks

CreganTur
10-22-2008, 08:22 AM
Send a PM to mdmackillop and see if this would meet the kb requirements. If not, then you could always post it as an article.

The only reason I say to do this is because you're not giving a VBA code example... which is the main purpose of the kb.

Demosthine
10-22-2008, 04:12 PM
Good Afternoon.

Are we a little over-zealous, Movian? I mean, do you honestly realize what you would would be undertaking in this?



i mean if i need to i guess i could broaden it to Office Constants


I mean, you have what 3,267 lines of Constants in that Module and that is just for MsWord. So we have Access, Outlook, PowerPoint, Project, Publisher, and Word. Does SharePoint count? I don't use Project or SharePoint, so I don't know... That comes to... Umm... Hold on... Carry the 4... Carry the 4 again... Overflow? What do you mean Overflow? Ok, that's a little under 23,000 lines of code. Yep, I said 23,000.

Not to discourage you are anything, but THAT'S CRAZY TALK!!!

I definitely have to give you props though, because I can only imagine how much work that took for you to do that for Word. You have a donation jar by chance. I might drop a few bucks 'cause that file is worth it.

It's dedication like that that truly makes this the most valuable Forum I've found online in years. You deserve a sticky or an award to post in your signature for that one.

Thanks for the file. I, at least, really appreciate the effort.
Scott

Movian
10-22-2008, 08:08 PM
Good Afternoon.

I mean, you have what 3,267 lines of Constants in that Module and that is just for MsWord. So we have Access, Outlook, PowerPoint, Project, Publisher, and Word. Does SharePoint count? I don't use Project or SharePoint, so I don't know... That comes to... Umm... Hold on... Carry the 4... Carry the 4 again... Overflow? What do you mean Overflow? Ok, that's a little under 23,000 lines of code. Yep, I said 23,000.

Scott

Well you set me a challenge (i know you didn't intend to but i took it as one :P ) so here it is

Word, Excel, Publisher, Power Point, Outlook and access

a class for each and 1 headache (mine :P ) all included in one handy zip file

Demosthine
10-22-2008, 08:21 PM
Ok, at only four hours, you have a secret you aren't sharing with everyone. Do you set some special loop to go through each of the Object's? Are you dating a Microsoft Geek? What's your little house-elf's name?

Nice job. And you actually have a donation link... I guess I know where I'm going Friday after I get paid. Does it go directly to you or your station?

Scott

Movian
10-23-2008, 04:31 AM
damn he is onto my secret computer super powers!!!!

*laugh out loud*

My Secret is Searching through the Microsoft MSDN site finding lists in very nasty formats - combining the information i need. Then spending time and effort using ingenious find and replace methodology to get it into a better format. Then spending good old fashioned time brushing everything up. And a little help with the fact that none of those additional modules had even a quater of the number of constants word did! Trust me it took every minute of those 4 hours :P

and that donation link goes directly to the website. If you can add a comment just say for Movian's work or something. and it is much appreciated.

Movian
05-15-2009, 08:40 AM
ok after my laptop died i lost ALL of my constants !! :(

Please if anyone still has a copy of the office zip file around i need the outlook list specifically. but the whole file would be usefull!

if you could either attach it or e-mail them to me at "Movian"Atsign"live.com
(split up like that to stop nasty web crawlers!) i would be eternally gratefull

DarkSprout
05-17-2009, 03:05 PM
Well you set me a challenge (i know you didn't intend to but i took it as one :P ) so here it is

Word, Excel, Publisher, Power Point, Outlook and access

a class for each and 1 headache (mine :P ) all included in one handy zip file


Don't forget Business Objects and MapInfo - they've all got VBA.
(Sorry!)
=DarkSprout=

OBP
05-18-2009, 04:33 AM
Movian, have you tried emailing Demosthine (http://www.vbaexpress.com/forum/member.php?u=18267) he doesn't appear to have been around for about a Month or so, reading this post he is the most likely one to have a copy.I wish I had seen the original post because I would have had one too.
Good Luck finding one.