Attribute vb name syntax error

VBA Атрибуты Синтаксис Атрибут VB_Name = «ClassOrModuleName» Атрибут VB_GlobalNameSpace = False ‘Игнорируется Атрибут VB_Creatable = False ‘Игнорируется Атрибут VB_PredeclaredId = Атрибут VB_Exposed = Атрибут variableName.VB_VarUserMemId = 0 ‘Zero указывает, что это член класса по умолчанию. Атрибут variableName.VB_VarDescription = «some string» ‘Добавляет текст в информацию обозревателя объектов для этой переменной. Attribute procName.VB_Description = «some string» […]

Содержание

  1. VBA Атрибуты
  2. Синтаксис
  3. VB_Name
  4. VB_GlobalNameSpace
  5. VB_Createable
  6. VB_PredeclaredId
  7. декларация
  8. Вызов
  9. VB_Exposed
  10. VB_Description
  11. VB_ [вар] UserMemId
  12. Указание члена класса по умолчанию для класса
  13. Создание класса с итерацией с помощью конструкции For Each loop
  14. VBA Attributes
  15. Syntax
  16. VB_Name
  17. VB_GlobalNameSpace
  18. VB_Createable
  19. VB_PredeclaredId
  20. Declaration
  21. VB_Exposed
  22. VB_Description
  23. VB_[Var]UserMemId
  24. Specifying the default member of a class
  25. Making a class iteratable with a For Each loop construct
  26. Thread: MVB syntax error on Attribute VB_name
  27. MVB syntax error on Attribute VB_name
  28. Re: MVB syntax error on Attribute VB_name
  29. Re: MVB syntax error on Attribute VB_name
  30. Re: MVB syntax error on Attribute VB_name
  31. Re: MVB syntax error on Attribute VB_name
  32. Re: MVB syntax error on Attribute VB_name
  33. Re: MVB syntax error on Attribute VB_name
  34. Re: MVB syntax error on Attribute VB_name
  35. Re: MVB syntax error on Attribute VB_name

VBA
Атрибуты

Синтаксис

  • Атрибут VB_Name = «ClassOrModuleName»
  • Атрибут VB_GlobalNameSpace = False ‘Игнорируется
  • Атрибут VB_Creatable = False ‘Игнорируется
  • Атрибут VB_PredeclaredId =
  • Атрибут VB_Exposed =
  • Атрибут variableName.VB_VarUserMemId = 0 ‘Zero указывает, что это член класса по умолчанию.
  • Атрибут variableName.VB_VarDescription = «some string» ‘Добавляет текст в информацию обозревателя объектов для этой переменной.
  • Attribute procName.VB_Description = «some string» ‘Добавляет текст в информацию обозревателя объектов для процедуры.
  • Атрибут procName.VB_UserMemId = <0 | -4>
    • ‘0: Делает функцию членом по умолчанию класса.
    • ‘-4: Указывает, что функция возвращает Enumerator.

VB_Name

VB_Name указывает имя класса или модуля.

Новый экземпляр этого класса будет создан с помощью

VB_GlobalNameSpace

В VBA этот атрибут игнорируется. Он не был перенесен с VB6.

В VB6 он создает глобальный экземпляр по умолчанию класса («ярлык»), так что к членам класса можно получить доступ без использования имени класса. Например, DateTime (как в DateTime.Now ) на самом деле является частью класса VBA.Conversion .

VB_Createable

Этот атрибут игнорируется. Он не был перенесен с VB6.

В VB6 он использовался в сочетании с атрибутом VB_Exposed для контроля доступности классов за пределами текущего проекта.

Это приведет к Public Class , к которому можно получить доступ из других проектов, но эта функциональность не существует в VBA.

VB_PredeclaredId

Создает глобальный экземпляр по умолчанию для класса. Экземпляр по умолчанию получает доступ через имя класса.

декларация

Вызов

В некотором смысле это моделирует поведение статических классов на других языках, но в отличие от других языков вы все равно можете создать экземпляр класса.

VB_Exposed

Управляет инстинктивными характеристиками класса.

Делает класс Private . Он не может быть доступен за пределами текущего проекта.

Выдает класс Public , вне проекта. Однако, поскольку VB_Createable игнорируется в VBA, экземпляры класса не могут быть созданы напрямую. Это эквивалентно следующему классу VB.Net.

Чтобы получить экземпляр извне проекта, вы должны открыть фабрику для создания экземпляров. Один из способов сделать это — с помощью обычного Public модуля.

Поскольку общедоступные модули доступны из других проектов, это позволяет нам создавать новые экземпляры наших классов Public — Not Createable .

VB_Description

Добавляет текстовое описание к члену класса или модуля, который становится видимым в Проводнике объектов. В идеале все публичные члены публичного интерфейса / API должны иметь описание.

Примечание. Все элементы доступа к объекту ( Get , Let , Set ) используют одно и то же описание.

VB_ [вар] UserMemId

VB_VarUserMemId (для переменных области модуля) и VB_UserMemId (для процедур) используются в VBA в основном для двух вещей.

Указание члена класса по умолчанию для класса

Класс List который будет инкапсулировать Collection должен иметь свойство Item , поэтому код клиента может сделать это:

Но с атрибутом VB_UserMemId установленным на 0 в свойстве Item , код клиента может сделать это:

Только один член может юридически иметь VB_UserMemId = 0 в любом заданном классе. Для свойств укажите атрибут в Get Access:

Создание класса с итерацией с помощью конструкции For Each loop

С магическим значением -4 , атрибут VB_UserMemId сообщает VBA, что этот член дает перечислитель, который позволяет клиенту сделать это:

Самый простой способ реализовать этот метод — вызвать скрытый [_NewEnum] свойства [_NewEnum] во внутренней / инкапсулированной Collection ; идентификатор должен быть заключен в квадратные скобки из-за ведущего подчеркивания, что делает его незаконным идентификатором VBA:

Источник

VBA Attributes

Syntax

  • Attribute VB_Name = «ClassOrModuleName»
  • Attribute VB_GlobalNameSpace = False ‘ Ignored
  • Attribute VB_Creatable = False ‘ Ignored
  • Attribute VB_PredeclaredId =
  • Attribute VB_Exposed =
  • Attribute variableName.VB_VarUserMemId = 0 ‘ Zero indicates that this is the default member of the class.
  • Attribute variableName.VB_VarDescription = «some string» ‘ Adds the text to the Object Browser information for this variable.
  • Attribute procName.VB_Description = «some string» ‘ Adds the text to the Object Browser information for the procedure.
  • Attribute procName.VB_UserMemId = <0 | -4>
    • ‘ 0: Makes the function the default member of the class.
    • ‘ -4: Specifies that the function returns an Enumerator.

VB_Name

VB_Name specifies the class or module name.

A new instance of this class would be created with

VB_GlobalNameSpace

In VBA, this attribute is ignored. It was not ported over from VB6.

In VB6, it creates a Default Global Instance of the class (a «shortcut») so that class members can be accessed without using the class name. For example, DateTime (as in DateTime.Now ) is actually part of the VBA.Conversion class.

VB_Createable

This attribute is ignored. It was not ported over from VB6.

In VB6, it was used in combination with the VB_Exposed attribute to control accessibility of classes outside of the current project.

Would result in a Public Class , that could be accessed from other projects, but this functionality does not exist in VBA.

VB_PredeclaredId

Creates a Global Default Instance of a class. The default instance is accessed via the name of the class.

Declaration

In some ways, this simulates the behavior of static classes in other languages, but unlike other languages, you can still create an instance of the class.

VB_Exposed

Controls the instancing characteristics of a class.

Makes the class Private . It cannot be accessed outside of the current project.

Exposes the class Public ly, outside of the project. However, since VB_Createable is ignored in VBA, instances of the class can not be created directly. This is equivalent to a the following VB.Net class.

In order to get an instance from outside the project, you must expose a factory to create instances. One way of doing this is with a regular Public module.

Since public modules are accessible from other projects, this allows us to create new instances of our Public — Not Createable classes.

VB_Description

Adds a text description to a class or module member that becomes visible in the Object Explorer. Ideally, all public members of a public interface / API should have a description.

Note: all accessor members of a property ( Get , Let , Set ) use the same description.

VB_[Var]UserMemId

VB_VarUserMemId (for module-scope variables) and VB_UserMemId (for procedures) attributes are used in VBA mostly for two things.

Specifying the default member of a class

A List class that would encapsulate a Collection would want to have an Item property, so the client code can do this:

But with a VB_UserMemId attribute set to 0 on the Item property, the client code can do this:

Only one member can legally have VB_UserMemId = 0 in any given class. For properties, specify the attribute in the Get accessor:

Making a class iteratable with a For Each loop construct

With the magic value -4 , the VB_UserMemId attribute tells VBA that this member yields an enumerator — which allows the client code to do this:

The easiest way to implement this method is by calling the hidden [_NewEnum] property getter on an internal/encapsulated Collection ; the identifier needs to be enclosed in square brackets because of the leading underscore that makes it an illegal VBA identifier:

Источник

Thread: MVB syntax error on Attribute VB_name

Thread Tools
Display

MVB syntax error on Attribute VB_name

Hi
I get a compile error on first line of the code that is in the text file attachment

I opened Word 2007
alt-F11 to bring up MVB
imported the bas file
and selected tools->macros, then ran it

«Compile Error: Syntax error» on the very first line,
It said this was wrong Attribute VB_Name = «Word2TWiki»

First few lines of Code is below===>>
Attribute VB_Name = «Word2TWiki»
‘Attribute VB_Name = «Word2Wiki»
Dim FileName As String, FolderName As String, doctitle As String
Dim htmlFile As String

Sub Word2TWiki()
‘This function can be used to convert a Word doc to the TWiki formatting language
‘For references: http://www.twiki.org/cgi-bin/view/Pl. ToTWikiMLAddOn
Dim runtime As Single ‘new
Dim tocfind As Boolean
runtime = Timer
Application.ScreenUpdating = False

FULL file is attached

Re: MVB syntax error on Attribute VB_name

Welcome to VBForums

The problem is with how you «imported the bas file«, as that line should be in the file — but not in the code (it is to tell VB what to use as the name of the file from within code, and in the window title etc).

It seems that you copied & pasted the contents of the file, whereas what you should do is right-click on the Project window and select «Import file. «. When I did that, the red line was not visible, but the part in quotes was used as the name.

Re: MVB syntax error on Attribute VB_name

Thanks for the help, yes, import got me past the problem on the first line of that bas file.

However, I now get another syntax error :

ConvertTables
ActiveDocument.Save
‘ Copy to clipboard
ActiveDocument.Content.Copy

Dim MyDataObj As New DataObject , GetOffClipboard As Variant

It flags what I highlighted and the pop-up says

Compile error: User-defined type not defined.

Re: MVB syntax error on Attribute VB_name

add a reference to msforms2 controls (object library)

i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

come back and mark your original post as resolved if your problem is fixed
pete

Re: MVB syntax error on Attribute VB_name

Hi Pete,
Were you referring to my post as code snippets? If so, my original post has the complete script/code attached. code snippets posted came from that attached file.

I dont have msforms2 as being available.

Im trying to compile a macro for ms word, through alt-F11 in win word, which pops up mvb.

Re: MVB syntax error on Attribute VB_name

if you add a userform it automatically adds a reference to msforms2 object library

otherwise you can go to menu > tools > references, find in the list and check the box

i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

come back and mark your original post as resolved if your problem is fixed
pete

Re: MVB syntax error on Attribute VB_name

I have an Access 2007 form where when a button’s clicked some data is concatenated into a string, of which there’s more data in the string than what a MsgBox will show and I would like to have it automatically be copied to the clipboard so I can verify the contents while I’m still building the functionality of the form. I got this code:

And I notice right off the bat that I get an «Object not defined error» and I found on this page http://word.mvps.org/FAQS/MacrosVBA/. eClipboard.htm that I need to add the reference to «Microsoft Forms 2.0 Object Library».

Here’s the problem, when I check the list of reference it’s not there, where is it?

Currently using VS 2015 Enterprise on Win10 Enterprise x64.

Re: MVB syntax error on Attribute VB_name

as i do not have access or 2007, i can not answer this question, access is different to word or excel, but i assume there is some method to use clipboard

i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

come back and mark your original post as resolved if your problem is fixed
pete

Re: MVB syntax error on Attribute VB_name

Can I see your dbf file for a faster resolution? Or if it is not for public view then can you mail it to me?

A good exercise for the Heart is to bend down and help another up.
Please Mark your Thread » Resolved», if the query is solved

MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27″ 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero

Источник

  • Home
  • VBForums
  • Visual Basic
  • Office Development
  • MVB syntax error on Attribute VB_name

  1. Jun 25th, 2009, 10:08 PM


    #1

    nn55nn is offline

    Thread Starter


    New Member


    MVB syntax error on Attribute VB_name

    Hi
    I get a compile error on first line of the code that is in the text file attachment

    I opened Word 2007
    alt-F11 to bring up MVB
    imported the bas file
    and selected tools->macros, then ran it

    «Compile Error: Syntax error» on the very first line,
    It said this was wrong Attribute VB_Name = «Word2TWiki»

    First few lines of Code is below===>>

    Attribute VB_Name = «Word2TWiki»
    ‘Attribute VB_Name = «Word2Wiki»
    Dim FileName As String, FolderName As String, doctitle As String
    Dim htmlFile As String

    Sub Word2TWiki()
    ‘This function can be used to convert a Word doc to the TWiki formatting language
    ‘For references: http://www.twiki.org/cgi-bin/view/Pl…ToTWikiMLAddOn
    Dim runtime As Single ‘new
    Dim tocfind As Boolean
    runtime = Timer
    Application.ScreenUpdating = False

    .
    .
    .

    FULL file is attached

    thanks
    Dennis


  2. Jun 26th, 2009, 09:44 AM


    #2

    Re: MVB syntax error on Attribute VB_name

    Welcome to VBForums

    The problem is with how you «imported the bas file«, as that line should be in the file — but not in the code (it is to tell VB what to use as the name of the file from within code, and in the window title etc).

    It seems that you copied & pasted the contents of the file, whereas what you should do is right-click on the Project window and select «Import file…». When I did that, the red line was not visible, but the part in quotes was used as the name.


  3. Jun 26th, 2009, 02:55 PM


    #3

    nn55nn is offline

    Thread Starter


    New Member


    Re: MVB syntax error on Attribute VB_name

    Thanks for the help, yes, import got me past the problem on the first line of that bas file.

    However, I now get another syntax error :

    ConvertTables
    ActiveDocument.Save
    ‘ Copy to clipboard
    ActiveDocument.Content.Copy

    Dim MyDataObj As New DataObject, GetOffClipboard As Variant

    It flags what I highlighted and the pop-up says

    Compile error: User-defined type not defined.

    thanks
    Dennis


  4. Jun 26th, 2009, 10:21 PM


    #4

    Re: MVB syntax error on Attribute VB_name

    Dim MyDataObj As New DataObject,

    add a reference to msforms2 controls (object library)

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  5. Jun 27th, 2009, 06:20 PM


    #5

    nn55nn is offline

    Thread Starter


    New Member


    Re: MVB syntax error on Attribute VB_name

    Hi Pete,
    Were you referring to my post as code snippets? If so, my original post has the complete script/code attached. code snippets posted came from that attached file.

    I dont have msforms2 as being available.

    Im trying to compile a macro for ms word, through alt-F11 in win word, which pops up mvb.

    Thanx
    Dennis


  6. Jun 27th, 2009, 09:08 PM


    #6

    Re: MVB syntax error on Attribute VB_name

    if you add a userform it automatically adds a reference to msforms2 object library

    otherwise you can go to menu > tools > references, find in the list and check the box

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  7. Sep 17th, 2009, 08:38 AM


    #7

    Re: MVB syntax error on Attribute VB_name

    I have an Access 2007 form where when a button’s clicked some data is concatenated into a string, of which there’s more data in the string than what a MsgBox will show and I would like to have it automatically be copied to the clipboard so I can verify the contents while I’m still building the functionality of the form. I got this code:

    Code:

    Dim MyData As DataObject
    Set MyData = New DataObject
    MyData.SetText MyStringVariableHere
    MyData.PutInClipboard

    And I notice right off the bat that I get an «Object not defined error» and I found on this page http://word.mvps.org/FAQS/MacrosVBA/…eClipboard.htm that I need to add the reference to «Microsoft Forms 2.0 Object Library».

    Here’s the problem, when I check the list of reference it’s not there, where is it?


  8. Sep 17th, 2009, 04:20 PM


    #8

    Re: MVB syntax error on Attribute VB_name

    as i do not have access or 2007, i can not answer this question, access is different to word or excel, but i assume there is some method to use clipboard

    see http://msdn.microsoft.com/en-us/library/bb258151.aspx for 2 methods

    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete


  9. Sep 17th, 2009, 05:19 PM


    #9

    Re: MVB syntax error on Attribute VB_name

    Can I see your dbf file for a faster resolution? Or if it is not for public view then can you mail it to me?

    A good exercise for the Heart is to bend down and help another up…
    Please Mark your Thread «Resolved», if the query is solved

    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27″ 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero


  10. Sep 17th, 2009, 07:53 PM


    #10

    Re: MVB syntax error on Attribute VB_name

    Quote Originally Posted by westconn1
    View Post

    That article looks promising, although I did manage to finish debugging the form without copying the data to the clipboard (it was tedious though) but it’s good to see an answer to this.

    Quote Originally Posted by koolsid
    View Post

    Can I see your dbf file for a faster resolution? Or if it is not for public view then can you mail it to me?

    Unfortunately I can’t send anyone the file as it holds personal information that would violate the HIPAA laws if I send it to anyone.


  11. Sep 18th, 2009, 01:21 AM


    #11

    Re: MVB syntax error on Attribute VB_name

    No i mean deleting the info it holds and simply uploading the structure….

    A good exercise for the Heart is to bend down and help another up…
    Please Mark your Thread «Resolved», if the query is solved

    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27″ 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero


  • Home
  • VBForums
  • Visual Basic
  • Office Development
  • MVB syntax error on Attribute VB_name


Posting Permissions

  • 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 On
  • [VIDEO] code is On
  • HTML code is Off

Forum Rules


Click Here to Expand Forum to Full Width

Чудовище под кроватью
Обычный пользователь
Обычный пользователь
 
Сообщения: 88
Зарегистрирован: 27.11.2006 (Пн) 14:46
Откуда: А из ника не ясно?

Attribute в VBA

Какие атрибуты есть в VBA? Меня интересует полный список. В object browser’e не нашел.

У-у-у!!


GSerg
Шаман
Шаман
 
Сообщения: 14286
Зарегистрирован: 14.12.2002 (Сб) 5:25
Откуда: Магадан

Сообщение GSerg » 09.01.2007 (Вт) 13:04

Что такого курил автор, что в VBA появились атрибуты?

Как только вы переберёте все варианты решения и не найдёте нужного, тут же обнаружится решение, простое и очевидное для всех, кроме вас


Чудовище под кроватью
Обычный пользователь
Обычный пользователь
 
Сообщения: 88
Зарегистрирован: 27.11.2006 (Пн) 14:46
Откуда: А из ника не ясно?

Сообщение Чудовище под кроватью » 09.01.2007 (Вт) 13:31

Я имею в виду атрибуты модуля и макроса. Например:

Код: Выделить всё
Attribute VB_Name = "Module1"
...
Attribute Macros1.VB_Description = “Тест”
Attribute Macros1.VB_ProcData.VB_Invoke_Func = “dn14″
...

Просто они в редакторе VBA скрыты почему-то, но они есть. Их можно увидеть, например, если выгрузить модуль в bas и открыть в любом текстовом редакторе.

У-у-у!!


Wolfie
Бывалый
Бывалый
Аватара пользователя

 
Сообщения: 213
Зарегистрирован: 06.03.2006 (Пн) 18:52
Откуда: Россия, Москва, СЗАО
  • ICQ

Сообщение Wolfie » 15.01.2007 (Пн) 19:55

Эти атрибуты ВБ и ВБА скрывают не просто так (хотя иногда самому жаль…) — они задаются через Procedure Attributes и кое-каие другие диалоги…. А зачем они — ведь если писать этот атрибут в самом редакторе, то он строку отвергает — а принудительно через Notepad в bas — зачем ?

··•··•••··•··••·•·•·•···••·•••···•···•••·•··•·•··
C:> per asper ad astra
‘ASTRA’ answer: Path ‘ASPER’ Not Found
684 Errare humanum est!
C:> _


Чудовище под кроватью
Обычный пользователь
Обычный пользователь
 
Сообщения: 88
Зарегистрирован: 27.11.2006 (Пн) 14:46
Откуда: А из ника не ясно?

Сообщение Чудовище под кроватью » 16.01.2007 (Вт) 7:20

Wolfie писал(а):Эти атрибуты ВБ и ВБА скрывают не просто так (хотя иногда самому жаль…) — они задаются через Procedure Attributes и кое-каие другие диалоги….

А где они в ВБА задаются? Не нашел :(

Wolfie писал(а):А зачем они — ведь если писать этот атрибут в самом редакторе, то он строку отвергает — а принудительно через Notepad в bas — зачем ?

Ну так хотя бы за тем, что можно hot-keys так сделать. Ну и имя модуля задать. Может, еще что-то полезное.

У-у-у!!


KL
Microsoft MVP
 
Сообщения: 483
Зарегистрирован: 30.10.2005 (Вс) 0:31
Откуда: Madrid

Сообщение KL » 18.01.2007 (Чт) 14:57

Может свойства и методы подойдут? Только установи ссылку на библиотеку: «Microsoft Visual Basic For Applications Extensibility #.#» да и если Excel 2002 и выше, то разреши доступ к объектам VB Project из меню Настройки-Макросы-Безопасность…. Тут примеры:

http://www.cpearson.com/excel/vbe.htm

Привет,

KL



Вернуться в VBA

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 0

There’s no need for the above code at all in VB.NET.

In VB 6, it specifies the name of the file from within code—this is used for things like the window title, as well as allowing you to explicitly qualify references to the members of that class in your code.

In VB.NET, the name used in the declaration of the class already serves that purpose. You no longer need to provide an explicit name with an Attribute. Consider the following mini-class:

Public Class MyFile
    Public Sub DoWork()
        'do something here
    End Sub
End Class

To call the DoWork method of the class you’ve named MyFile from another place in your code, you would simply write:

MyFile.DoWork()

just as you could after you specified the VB_Name attribute under previous versions of VB.

Also note that the file name that your class/module is saved as can be something completely different; the name you specify in the class declaration is not dependent on the name you’ve given the file itself, just like previous versions.

Понравилась статья? Поделить с друзьями:
  • Attribute key error
  • Attribute error python почему
  • Attribute error python object has no attribute
  • Attrib exe ошибка при запуске приложения 0xc0000142
  • Attila total war ошибка при запуске vfs error could not load the mods