Solved

VBA Word; Hide namebar ...

Posted on 2002-07-30
12
133 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
Industry Leaders: 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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…

710 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