Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 9th, 2005, 04:08 PM
Authorized User
 
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default remove Excel Toolbars using an ActiveX DLL

Hi all,

I'm trying to remove the Excel toolbars from within an ActiveX DLL made with VB6. I'm getting several errors, and I have problems with refering to a constant (msobarTypeNormal). If anyone has experience with this, your help will be much appreciated. Here is my code:

Public Sub remove_toolbars(wkb) 'wkb is the refered workbook, this works correct! ' Dim TB 'As what??? Dim TBNum As Integer Dim xlWorkbook As Object Dim xlSheet1 As Excel.Worksheet ' Set xlWorkbook = GetObject(wkb) Set xlSheet1 = xlWorkbook.Sheets(1) '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''
'clear the column
xlSheet1.Range("B:B").Clear
'Hide all visible toolbars and store their names
TBNum = 0
For Each TB In Excel.CommandBars 'here goes wrong
    MsgBox "TB = " & TB
    If TB.Type = msoBarTypeNormal Then 'does not recognize msoBarTypeNormal constant
        MsgBox "Test"
        If TB.Visible Then
            TBNum = TBNum + 1
            TB.Visible = False
            xlSheet1.Cells(TBNum, 2).Value = TB.Name
        End If
    End If
Next TB
'
Excel.CommandBars("Worksheet Menu Bar").Enabled = False
MsgBox "done commandbars"
'
End Sub

Thanks in advance
Max


Reply With Quote
  #2 (permalink)  
Old September 11th, 2005, 08:05 AM
Authorized User
 
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

i found it myself. Set a reference in ActiveX DLL to "Microsoft Office Library 9.0", then type the following code:

If TB.Type = Office.msoBarTypeNormal
etc etc

The reference made sure that VB6 knows the constants used in VBA.

Max
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advantages /Disadvantages of ActiveX DLL & ActiveX priyank Beginning VB 6 6 February 19th, 2007 11:34 AM
ActiveX DLL Joann Beginning VB 6 6 January 25th, 2007 08:50 PM
Removing Excel toolbars from within ActiveX DLL maxpotters Excel VBA 1 September 11th, 2005 08:05 AM
How do I debug an ActiveX DLL referenced by Excel? James Diamond Pro VB 6 4 July 19th, 2004 01:05 PM
Referencing an ActiveX DLL from Excel james gold Excel VBA 1 September 10th, 2003 10:41 AM



All times are GMT -4. The time now is 04:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.