Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA 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 8th, 2005, 01:19 PM
Authorized User
 
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default Removing toolbar from ActiveX DLL in VB6

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:04 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
Removing Excel toolbars from within ActiveX DLL maxpotters Excel VBA 1 September 11th, 2005 08:05 AM
Creation of ActiveX DLL with VB6 james gold VB Components 2 December 28th, 2003 04:02 PM
Can a VB6 ActiveX DLL reference a spreadsheet? james gold Pro VB 6 0 October 2nd, 2003 10:02 AM
Creation of ActiveX DLL with VB6 james gold Pro VB 6 2 September 10th, 2003 08:19 AM



All times are GMT -4. The time now is 04:11 AM.


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