|
-
Jan 26th, 2006, 11:01 PM
#1
Thread Starter
Member
[RESOLVED] CommandBar problem
I am trying to create a commandbar, but unfortunately I am getting the following error: User defined type not defined. And yes, I have set a reference to Microsoft 9.0 Object Library in the VBE. That was the first thing I checked....
The error occurs at the first line, where I try to declare the command bar:
VB Code:
Dim cbrMenuBar As CommandBar
Set cbrMenuBar = CommandBars.Add("MyBar", msoBarTop, True, True)
cbrMenuBar.Visible = True
Thanks all
Last edited by Santos7772005; Jan 30th, 2006 at 07:35 PM.
Reason: Resolved
-
Jan 26th, 2006, 11:17 PM
#2
Re: CommandBar problem
?? strange. did you try removing the library? then adding it back in?
was CommandBar an available "choice" in the intellisense dropdown?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 26th, 2006, 11:43 PM
#3
Re: CommandBar problem
"Microsoft 9.0 Object Library"? Which program are you trying to add it to?
Usually you add a reference to "Microsoft Excel xx.0 Object Library"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 27th, 2006, 04:26 AM
#4
Lively Member
Re: CommandBar problem
i kept having this problem , try adding office. before the commandbar?
worked for me, the same with outlook, i had to write outlook.application, just wouldnt work with application on its own
jamie
-
Jan 27th, 2006, 07:45 AM
#5
Thread Starter
Member
Re: CommandBar problem
Ok, thanks for the feedback guys. No, commandbar was not a choice in the intellisense dropdown. This code is part of an export routine in Access - what I am trying to do is output a word document. My database contains test scripts that our company uses to test our products, what I am trying to do is output these test scripts to a word document as autotext entries, and then attach each one to a button on a commandbar.
-
Jan 27th, 2006, 10:25 AM
#6
Re: CommandBar problem
ok.. if you do not get CommandBar as an Intellisense choice then u do not have the correct refrence...
Try adding ref to Word Object...
Try typing Office. is office a "choice"?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 27th, 2006, 10:32 AM
#7
Re: CommandBar problem
If your writting this with Word then it will be accessible from...
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 30th, 2006, 02:45 PM
#8
Thread Starter
Member
Re: CommandBar problem
After doing a bit more investigation I have found that the code I originally posted works fine if it is in a word document, so my problem is with Access. Is there any way to write out a word document from access and create the toolbar at the same time? If not I guess I will just have to write this code in word and have it get the data from access, I was really hoping to have it the other way round... in any case thanks for your help guys
-
Jan 30th, 2006, 02:49 PM
#9
Re: CommandBar problem
Did you add a reference to Word and Office in Access' VBA IDE?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 30th, 2006, 07:35 PM
#10
Thread Starter
Member
Re: CommandBar problem
Did you add a reference to Word and Office in Access' VBA IDE?
Ok, thanks, thats the problem! I only had a reference to word - I did not have a reference to the Office objects library.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|