Solved

VBA Word; Hide namebar ...

Posted on 2002-07-30
12
134 Views
Last Modified: 2010-05-01
Hey!

I need to hide the namebar on my form (frm1), when run in word.

I don't know if i called it at it's right name, but the bar is the one where frm1.caption is shown.

Can anyone help med with this?

Regards
nicolaus
0
Comment
Question by:nicolaus
[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
  • 6
  • 5
12 Comments
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7188151
nicolaus
Do you mean the title bar
.. if so the following article may help
http://www.vbaccelerator.com/tips/vba0016.htm
0
 

Author Comment

by:nicolaus
ID: 7189729
BCUNNEY>>
Thats exactly what i mean. But the link you provided is dead - "problems with the homepage".

I'll try again later, to see if it works then.

(Maybee you could desribe in short what to do - or not to do)
0
 

Author Comment

by:nicolaus
ID: 7190298
The homepage is still a problem.

Could you assist me?
0
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!

 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7190481
nicolaus,
will try and get source code for you
give me 30 mins

Cheers
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7190540
nicolaus
I thought I had saved the source from above article but I had not.
In the meantime take a look at this article
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q83349
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7190569
nic
This is another sample which may give you some ideas
http://www.vbdiamond.com/Sources/ViewSource.asp?ID=17008
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7190573
Have a look at the Custom Caption demo on this page
http://www.softcircuits.com/sw_vbsrc.htm
0
 

Author Comment

by:nicolaus
ID: 7192563
Thank you very much, BCUNNEY.

But all the above samples is for VB, and i need the code to run in VBA for Word.
0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 7193014
I thought you may be able to do something similar in Word VBA - if I get a chance I will see if I can apply some of the above example code in Word vba - What version of Word are you using??
0
 

Author Comment

by:nicolaus
ID: 7193051
Thank you. I don't think i can use the examples in VBA - tryed before.

I'm using Word 2000.
0
 

Author Comment

by:nicolaus
ID: 7200188
Thank you for all your help. But i figured it out myself.

With this code, i have solved my problem:

Private Declare Function FindWindow Lib "user32" Alias _
      "FindWindowA" (ByVal lpClassName As String, ByVal _
      lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
      "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
      As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
      "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
      As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal _
      hwnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias _
      "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
      ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private wHandle As Long

Private Sub UserForm_Initialize()
    If Val(Application.Version) >= 9 Then
        wHandle = FindWindow("ThunderDFrame", Me.Caption)
    Else
        wHandle = FindWindow("ThunderXFrame", Me.Caption)
    End If
    If wHandle = 0 Then Exit Sub
    frm = GetWindowLong(wHandle, GWL_STYLE)
    frm = frm Or &HC00000
    SetWindowLong wHandle, -16, frmStyle
    DrawMenuBar wHandle
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal _
        Shift As Integer, ByVal X As Single, ByVal Y As Single)
    If wHandle = 0 Then Exit Sub
    If Button = 1 Then
        ReleaseCapture
        SendMessage wHandle, &HA1, 2, 0
    End If
End Sub

nicolaus
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 50 total points
ID: 7200821
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 14 hours left to enroll

632 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