|
-
May 13th, 2003, 05:38 PM
#1
Thread Starter
yay gay
Using Macros
how can i put some visible thing of a macro? i mean..like a form, inputbox..whenever i try to put a inputbox it just wont open..if i try to load a form the form freezes i dunno why..anyone has any idea? anyone has worked with macros?
\m/  \m/
-
May 14th, 2003, 03:31 AM
#2
I just wrote this macro. It works fine for me. Is this something like what you are having trouble with?
VB Code:
Public Sub macTRIS001()
Dim i As Integer = InputBox("How many times?", "Write the letter 'A'", 0)
Dim x As Integer
For x = 1 To i
DTE.ActiveDocument.Selection.Text = "A"
Next
End Sub
This world is not my home. I'm just passing through.
-
May 14th, 2003, 07:22 AM
#3
Thread Starter
yay gay
yep, that worked, but what about forms? i mean..i want the user to have some options on what to do..how can i accomplish this?
\m/  \m/
-
May 14th, 2003, 07:40 AM
#4
Thread Starter
yay gay
the way seems to be vs.net addins..anyone had worked in anything of this? any one has any experience/thoughs about this?
\m/  \m/
-
May 14th, 2003, 08:31 AM
#5
Member
Hi
I usually design a standalone Form first and then copy the form class into the macro module. You can then instantiate the form, show it (ShowDialog method) and respond to the user selections on that form.
Hope this helps
Harold Hoffman
-
May 14th, 2003, 08:33 AM
#6
Thread Starter
yay gay
as ive said above everytime i try to instantiate a class it just freezes up.......that doesnt happen to u?
\m/  \m/
-
May 14th, 2003, 09:02 AM
#7
Member
Hi
My Forms work fine in a macro. If you post your macro I'll try it out.
Harold Hoffman
-
May 14th, 2003, 10:54 AM
#8
Thread Starter
yay gay
sub Test()
dim f as new Form()
f.ShowDialog()
end sub
this aint working..
btw are utalking about MACROS or VS.NET ADDINS? they're different things!
\m/  \m/
-
May 14th, 2003, 11:01 AM
#9
Member
Hi
Yes. I am talking about macros not addins. Where is your Form class defined?
Harold Hoffman
-
May 14th, 2003, 11:04 AM
#10
Thread Starter
yay gay
for testing purposes i didnt create a form for myself, i just instanciated as in the above code a "regular" form but is keeps freezing :S
\m/  \m/
-
May 14th, 2003, 12:07 PM
#11
Member
Hi
I tested your code and it works fine. I also added a button and it also appeared on the form.
Sub Macro1
Dim f As New Form()
Dim btnSave As New Button()
btnSave.Visible = True
btnSave.Text = "Save"
f.Controls.Add(btnSave)
f.ShowDialog()
End Sub
I don't know why this is not working for you.
Harold Hoffman
-
May 14th, 2003, 12:11 PM
#12
Thread Starter
yay gay
now worked! i think it had something to do with .Show() as with .ShowDialog() its working ok..tks anyways
\m/  \m/
-
May 14th, 2003, 12:20 PM
#13
PowerPoster
.ShowDialog() stops executing the current proceedure until the form you just shown is returned. You were probably having a problem because if you use .Show(), then the form will show, but the code in the macro will continue to process, and it was reaching the end and terminating the whole thing (which includes the form you showed).
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
|