Solved

VBA Word; Hide namebar ...

Posted on 2002-07-30
12
129 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
Comment Utility
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
Comment Utility
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
Comment Utility
The homepage is still a problem.

Could you assist me?
0
 
LVL 17

Expert Comment

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

Cheers
0
 
LVL 17

Expert Comment

by:Barry Cunney
Comment Utility
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
Comment Utility
nic
This is another sample which may give you some ideas
http://www.vbdiamond.com/Sources/ViewSource.asp?ID=17008
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 17

Expert Comment

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

Author Comment

by:nicolaus
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Points refunded and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

15 Experts available now in Live!

Get 1:1 Help Now