Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

See my code in IDE?????

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom_OM - 29 Apr 2006 23:49 GMT
I guess I'll just have to risk looking foolish.  I have a few years
experience with VB 6, and so I figured it would be a snap to dive
right into VBA to create Word macros.  I've recorded them and assigned
each one to a hot key with no trouble.  

However, I'm having difficulty in opening my code.  In regular VB 6,
I've always clicked on the "view code" icon to see my code, and it's
always worked with no problem.  However, it's not working in the VBA
IDE for some reason.  I understand my macro code is in the normal.dot
file.  Unfortunately, the VBA IDE does not seem to want to let me view
the code I've just recorded.  Frustrating!  

Here's what I'm seeing:
http://www.renamestar.com/wordproshots/vbaide2.htm

When I've clicked on "Normal", the View Code icon is grayed out.
Makes sense.  What doesn't make sense is when I click on "NewMacros"
the View Code button un-grays as if I could click on it to see my code
(as seen in my illustration).  I do so, but nothing happens -- no
error message, nothing.  

If I click on anything else under "Normal", (This Document, UserForm1,
etc.)  it also acts as if I can click on View Code to see my macros'
code, but I have no luck with that either.  I'm using Word XP under
Windows XP Pro.  I also tried the same thing with Word 2K, which is
also on my system, but I had the same frustration.

What am I missing?  Is there something wrong with my install of Office
XP?  Is there some kind of security setting that I have to change?
I'm  stumped.  
Shauna Kelly - 30 Apr 2006 02:06 GMT
Hi Tom

Try double-clicking the module name in the Project Explorer. That should
open up the code in a large white pane on the right.

>I figured it would be a snap to dive
> right into VBA to create Word macros

You're not the first one to have jumped to that conclusion!

The following might help:

Getting To Grips With VBA Basics In 15 Minutes
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm

How to modify a recorded macro
http://www.word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm

and in general, see the articles at:

Word MVP FAQ - Macros/VBA
http://www.word.mvps.org/FAQs/MacrosVBA.htm

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

>I guess I'll just have to risk looking foolish.  I have a few years
> experience with VB 6, and so I figured it would be a snap to dive
[quoted text clipped - 26 lines]
> XP?  Is there some kind of security setting that I have to change?
> I'm  stumped.
Tom_OM - 30 Apr 2006 03:12 GMT
Thanks for the help, Shauna (and those links as well as your site look
useful).  Unfortunately, I'm still not having any luck.  Now just to
be certain I'm not wacked-out, the Project Explorer is what I've shown
in my screenshot, right?  
screen shot: http://www.renamestar.com/wordproshots/vbaide2.htm

When I double click on "Normal" the sub-categories "NewMacros,"
ThisDocument, UserForm1, etc. come up.  When I double click on any of
those, I get no code window.  When I double click on "ThisDocument,"
the Properties index does come up, but no code does.  

If I right click on the same items and choose "View Code," I also get
nothing.  I wondered if some of the add-ins I have installed somehow
conflicted.  These are my add-ins (which you can also see in the
screenshot of my Project Explorer:

Project (DVZWDAddin
TemplateProject (Bs2000)
WordStar_Template (WordStar)
I tried disabling all of these, but still couldn't get the code to
view.  

Am I doing everything right?  Is my install of Word somehow flawed?
That's hard to believe since I have the same problem in Word 2K as I
do in Word XP.  The only difference I saw between these two apps was
that the WordStar_Template add-in did not load in Word 2K.  I don't
know if that's relevant.  

Also, if I click on any of the add-ins, I get the message "Project is
unviewable," which should not be a problem since I want to edit my own
code, not the code of the authors of those add-ins.  Plus, if I
disable the add-ins, I still can't view my own code.  That leads me to
believe that the add-ins aren't the problem.  

Frustrated.  Arg.  

Any ideas?  

>Hi Tom
>
>Try double-clicking the module name in the Project Explorer. That should
>open up the code in a large white pane on the right.
Shauna Kelly - 30 Apr 2006 03:46 GMT
Hi Tom

> "Project is unviewable,"

If an add-in is loaded (ie a .dot file is listed and ticked at Tools >
Templates and Add-ins), then it is not thereby viewable or editable in the
VBE.

You have to do File > Open and actually open the .dot file, and then use the
VBE to work with the open file. (Don't just double-click in Windows
Explorer; that will create a new document based on the .dot file, which
won't hold your code, and isn't what you need.)

Apart from that, I would suggest using Start > Run and running "winword.exe
/a" (no quotes). This will start Word without any add-ins. This is what
happens if I do that:

After opening, I see a blank document. I do Alt-F11. I can see the Project
Explorer (yes, what you show in your screen shot), showing Normal and
Project (Document 1) with "This Document" highlighted. I double-click it,
and the large white code pane opens.  Type some text in the big white pane,
so you can distinguish it from other code.

I can do Insert > Module and Word will insert a Module1 into Modules under
Project (Document 1). However, I can only go back and forth between viewing
the code in ThisDocument and the code in Module1 by double-clicking.

If all is OK having opened Word with the /a switch, then you can safely
assume that any problems are being caused by the add-ins.

For what it's worth, I find it useful to unload all add-ins when I'm coding
(well, except for little tools I've created for myself). Otherwise, you
don't know whether the UI or Word's behaviour is coming from Word or from
the add-in.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

> Thanks for the help, Shauna (and those links as well as your site look
> useful).  Unfortunately, I'm still not having any luck.  Now just to
[quoted text clipped - 38 lines]
>>Try double-clicking the module name in the Project Explorer. That should
>>open up the code in a large white pane on the right.
Jay Freedman - 30 Apr 2006 04:14 GMT
Hi Tom,

By default, both the Project Explorer and the Properties pane are
docked only to the left side of the IDE and are only about 1/3 of the
width of the window. I think what's happening is that the code window
is hidden behind your full-width panes. If so, it will be listed in
the Window menu.

Try right-clicking a blank area in the Project Explorer and unchecking
the Dockable item in the context menu. Then resize it to 1/3 the width
and 1/2 the height of the IDE, and turn on Dockable again -- it should
dock to the left side. Do the same with the Properties pane. Then you
can maximize the code window, which will take the remaining space.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>Thanks for the help, Shauna (and those links as well as your site look
>useful).  Unfortunately, I'm still not having any luck.  Now just to
[quoted text clipped - 38 lines]
>>Try double-clicking the module name in the Project Explorer. That should
>>open up the code in a large white pane on the right.
Tom_OM - 30 Apr 2006 20:35 GMT
Success, at last.  I can open up my code now.  Shauna and Jay, thank
you very much for your help.  The code window must have somehow gotten
hidden, but I couldn't find it.  I ended up uninstalling and
reinstalling Office XP.  After I then opened up Word, it burped and
couldn't load the WordStar add-in, so it asked if I wanted to delete
it.  I chose Yes, and then the code window would come up when I
clicked View Code.

I was worried that it was the add-in's fault and I therefore wouldn't
be able to use it.  However, when I reinstalled it, it worked without
making me unable to view the code.  Thank goodness because that's an
add-in I really want to use.  (If you're curious, here's where I got
it: http://www.wordstar.org/wsemu/word/pages/intro.htm).  

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.