Solved

VBA Word; Hide namebar ...

Posted on 2002-07-30
12
130 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
  • 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
 
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
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.

 
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

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now