Click here to Skip to main content
15,887,244 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionIs there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll4-Apr-09 9:23
FeRtoll4-Apr-09 9:23 
AnswerRe: Is there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll4-Apr-09 9:41
FeRtoll4-Apr-09 9:41 
AnswerRe: Is there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll4-Apr-09 9:56
FeRtoll4-Apr-09 9:56 
AnswerRe: Is there anny way to turn off webbrowser navigation sound??? Pin
FeRtoll8-Apr-09 10:39
FeRtoll8-Apr-09 10:39 
QuestionWindows Explorer menus Pin
JR2124-Apr-09 4:46
JR2124-Apr-09 4:46 
AnswerRe: Windows Explorer menus Pin
LloydA1114-Apr-09 12:43
LloydA1114-Apr-09 12:43 
GeneralRe: Windows Explorer menus Pin
JR2124-Apr-09 20:47
JR2124-Apr-09 20:47 
QuestionVBA Modeless form that modifies code module is lost after call completion? Pin
DonQuiyote4-Apr-09 4:13
DonQuiyote4-Apr-09 4:13 
I am trying to show a modeless userform in VBA Word to make available several editing functions (a floating toolbar in effect). But adding lines of code at run-time makes it impossible to keep the shown form after the caller completes execution.

I am working in Word 2007, using the built-in VBA editor. These modules are part of a custom built template.

I am adding the buttons at run time to simplify customisation and loading, since I have separate sets of functions I apply this method to. I do this by iterating the particular code module grouping the procedures I want to make accessible while word processing. This takes place in a module spearate from the form. I can find the code added correctly in the userform afterwards. For example

.AddFromString "Sub CommandButton1_Click()" + vbCr + _
"Unload Me" + vbCr + _
"End Sub"
.AddFromString "Sub " + Proc + "_Click()" + vbCr + _
Title + "." + Proc + vbCr + _
"End Sub"

Produces

Sub CommandButton1_Click()
Unload Me
End Sub
Sub pasteSynonyms_Click()
TextCommandsModule.pasteSynonyms
End Sub

etc

The form is created, and appears intact when the show procedure is called. However, when the calling sub exits (invoked either by a shortcut or with a macrobutton in the text) the form disappears again. Removing the lines that add functionality to the buttons, by adding instructions to the codemodule, overcomes this. But I am left with pretty buttons that dont do anything.

I have tried creating the form at run time. I have tried adding a new instance, declared as global variable, of a form template that I build on, and I have tried using the userform module itself, as default instance. In all cases the form is released and, in the case of a new instance, is also unloaded again. I use other modeless forms in the same application without this problem: I can invoke them and they stay around after the calling sub exits again. The difference is that I call the sub to dynamically modify controls, and that I insert lines of code.

How can I add code and avoid the userform disappearing when the code returns?

modified on Sunday, April 5, 2009 10:11 PM

QuestionHow to show the changes Updated by other user on network Pin
ejaz_pk3-Apr-09 22:17
ejaz_pk3-Apr-09 22:17 
AnswerRe: How to show the changes Updated by other user on network Pin
Eddy Vluggen4-Apr-09 0:13
professionalEddy Vluggen4-Apr-09 0:13 
QuestionMicrosoft Access Database Backup by vb 6.0 Pin
ejaz_pk3-Apr-09 22:11
ejaz_pk3-Apr-09 22:11 
AnswerRe: Microsoft Access Database Backup by vb 6.0 Pin
Eddy Vluggen4-Apr-09 0:02
professionalEddy Vluggen4-Apr-09 0:02 
AnswerRe: Microsoft Access Database Backup by vb 6.0 Pin
Anubhava Dimri6-Apr-09 20:41
Anubhava Dimri6-Apr-09 20:41 
Questionhow to connect mysql DB ? Pin
JC.KaNNaN3-Apr-09 20:50
JC.KaNNaN3-Apr-09 20:50 
AnswerRe: how to connect mysql DB ? Pin
Christian Graus3-Apr-09 23:17
protectorChristian Graus3-Apr-09 23:17 
GeneralRe: how to connect mysql DB ? Pin
akhilonly0075-Apr-09 22:36
akhilonly0075-Apr-09 22:36 
Questionhow to print same page itself (without going report page) ? Pin
JC.KaNNaN3-Apr-09 20:44
JC.KaNNaN3-Apr-09 20:44 
AnswerRe: how to print same page itself (without going report page) ? Pin
Anubhava Dimri3-Apr-09 22:07
Anubhava Dimri3-Apr-09 22:07 
GeneralRe: how to print same page itself (without going report page) ? Pin
JC.KaNNaN3-Apr-09 22:40
JC.KaNNaN3-Apr-09 22:40 
GeneralRe: how to print same page itself (without going report page) ? Pin
Anubhava Dimri3-Apr-09 23:13
Anubhava Dimri3-Apr-09 23:13 
AnswerRe: how to print same page itself (without going report page) ? Pin
Mohammed.Al-Qaisi5-Apr-09 23:33
Mohammed.Al-Qaisi5-Apr-09 23:33 
Question[Message Deleted] Pin
nilleshkumar3-Apr-09 20:11
nilleshkumar3-Apr-09 20:11 
AnswerRe: help me pls urgent Pin
Christian Graus3-Apr-09 23:20
protectorChristian Graus3-Apr-09 23:20 
Questionvisual bais output written to excel Pin
jazzgirl3-Apr-09 15:27
jazzgirl3-Apr-09 15:27 
AnswerRe: visual bais output written to excel Pin
ChandraRam3-Apr-09 22:08
ChandraRam3-Apr-09 22:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.