Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Opening Multiple Com Objects

I have a NT service written in VB, I want this service to monitor several mail boxes and when new mail arrives call a COM DLL or EXE to deal with the incoming mail. Each mailbox may have its own Dll or Exe registered with MTS.
I am a web developer and I am quite new to VB so the following question may be somewhat trivial:


Can the VB service call a COM object and let it run without having to wait for it to finish. I already have used COM objects from a mail agent but these wait till the COM object has finished executing before it can move on. The COM object will have their own error handling.

I know VB is not truly multithreaded but is it still possible to have multiple Com objects opened from the same service and executing at the same time, even if this does mean CPU sharing in VB.

Sean Martin

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With Opening Multiple Txts Files In A Single Excel Files With Multiple Worksheets
I am new to using visual basic code as I usually use it for making macros inside the Excel program.

I would like to to open numerous text/ascii files into a excel file. I would like to write VB code that I can point to a directory (and it's subdirectories) to identify text files in the folder and import the data of each file into one excel file. Each separate file would be opened into a new work sheet. File1 goes to excel file worksheet 1, file2 same excel file worksheet 2 etc. etc. What is the best way to do this? Is there a script out there that already does this?
What I want to avoid is manually open up and copy each of these fields to a new or manually use the import text wizard as we will a large number of separate files with data.

This forum thread has the code which seems to do what I need but I got it to work only once and then i get errors all time.
Does it need to run as VB project or as a macro in excel??

microsoft has a example of what i want to do but again not in enough detail for a novice programmer is another example but i want to opem multiple files in one goal

After this code we have rearrange our using another excel marco and graph the data so we have a lot of work ahead of us
Thanks for your help in advance!


Working On Multiple Objects
How to work on multiple objects - for example, having several textboxes, how to change their text field using one call/loop?
They are named Text1, Tex2, etc.

Wait For Multiple Objects
Hello all,

I am using waitforsingleobject(API) to wait for one application/process. But my problem comes when I my called application starts second process. At that time my application hangs. I tried with waitformultipleObjects but that is not working properly.

Thanks in advance

Multiple ADO Recordset Objects

I have a situation where many procedures of a form are using a ADO connection declared under the General section of the form code:

Option Explicit

Dim db As New ADODB.Connection
Dim rst As New ADODB.Recordset
Now inside one of the procedures I need to define a separate recordset object,say "rst1" using the same connection object "db".

Do I need to use the 'NEW' keyword to create a new instance of the recordset object variable inside the procedure or is it not necessary to use 'NEW'?

Private Sub readdata()

Dim rst1 As New ADODB.Recordset


Private Sub readdata()

Dim rst1 As ADODB.Recordset

Which of the two should I use & why?

Thanks in adavnce.

Multiple Objects Under One Roof
I have multiple objects, which form part of another object. For ease of understanding, they are

Mailing - which is the main object.


AddressData - which holds company name, street details etc.
ExtdAddressData - which holds salutation, first name, surname, country etc.
MailsortData - holds details of what zone the address is going to, etc.
Baglabel - holds details of number of addresses to certain locations.

My app adds addressdata to the AddressData and /or ExtdAddressData object(s) and adds the filled object to the Address object(s) held in Mailing.

Question - Instead of having to set each object to other objects each time, how can I add a main class so that all I have to say is something like

Set AddressDetails =Mailing.AddressDetails

Multiple Objects Equals....
Can I make more than one object get the same value like:

Text1.Text, Command4.Caption = "Test"

Now I know this doesn't work, but can it be done?

Coding Multiple Objects

I have the following code:

Private Sub txtStud7_AfterUpdate()

'//To make the Jamb Width change according to:
'//Stud Width and Jamb Profile

Dim JAMB As Integer
Dim stud As Integer


stud = Int(txtStud7)

'If Profile is Architrave, then Jamb = Stud + 22
'If Profile is Grooved, then Jamb = Stud + 45
'If MUF Grooved, stud 70, then Jamb = Stud + 51
'If MUF Grooved, stud 90, then Jamb = Stud + 52

If stud = 0 Then
MsgBox "Please enter required Jamb size", vbExclamation, "Enter Jamb Size"
JAMB = 0
GoTo 16

ElseIf comJMaterial = "Pine" And ComJProfile = "Flat" Then
JAMB = stud + 22
ElseIf comJMaterial = "Pine" And ComJProfile = "Grooved" Then
JAMB = stud + 45
ElseIf comJMaterial = "MUF" And ComJProfile = "Flat" Then
JAMB = stud + 22
ElseIf comJMaterial = "MUF" And ComJProfile = "Grooved" And stud = 70 Then
JAMB = stud + 51
ElseIf comJMaterial = "MUF" And ComJProfile = "Grooved" And stud = 90 Then
JAMB = stud + 52
ElseIf ComJProfile = "Flat" Then
JAMB = stud + 22

End If

'//Reminds user to change Jamb size depending on lining type
If vbNo = MsgBox(prompt:="Jamb size is based on 2 layers of 10mm Gib - Okay?", Buttons:=vbYesNo + vbQuestion, Title:="Confirm Lining") Then
MsgBox "Please alter Jamb size accordingly", vbExclamation, "Change Jamb Size"
JAMB = 0
End If

txtJamb7 = Str(JAMB)
End Sub

It works how I want it to, but the problem is that I have 26 each of the txtJamb* and txtStud* boxes. Every time I make a change I have to change 26 pieces of code. The only difference between each one is the number at the end of the txtJamb* and txtStud* boxes. Is there a way to write one piece of code for all 52 boxes?


Drag And Drop Multiple Objects
I am trying to write some code that selects a number of image boxes and drags them all together to be dropped to another portion of the form. I have set drag mode to manual and tried to start the drag in the following way...

For i = 0 To UBound(selected)
Imageshadow(get_index(selected(i))).Drag vbBeginDrag
Next i

However, this seems to only initiate the drag on the last of the arrays cycled through. Does anyone know how to do this properly? Or know of a tutorial where this is done?

Problems With Textures On Multiple Objects
I have been studying the tutorials at and I have been looking at creating keyframe animations in directx 8.1. I have tried to modify the code on lesson 10 to do multiple objects, but cannot get the textures to be applyed to any other object that my first one. Please view my amendments and tell me where I am going wrong.

A Sub That Handles The Same Event For Multiple Objects
Is there a way to do this, for example, when you have a series of text boxes, and whenever anyone of them gets focus, it runs a counter. Is there a way to write

Private sub LostFocus()

end sub

without having to write a

Private Sub Textx_LostFocus()
End sub

For every object?


Any Wat To BitBlt One Image Onto Multiple Objects?
Lets say I have four PictureBoxes. All are exactly the same. Is there a way to draw the image so that its center is in the center of the four pictureboxes? I am using the trick where you load the image into an imagelist, set the mask, then redraw it onto the target object.

Format Multiple Mshflexgrid Objects
Hello. I want to format 12 diferent mshflexgrid with the same style. Can I do that using a procedure or do I have to format each object ?

Changing The Properties Of Multiple Objects At Once
I want to make multiple controls enabled at once, say using a loop.

VB Code:
Dim x As Integer Dim objects() As Variant objects(0) = "cmdGo"objects(1) = "cmdReset"objects(2) = "cmdClipboard"objects(3) = "txtInput"objects(4) = "cmdUnits"objects(5) = "lblOutput"objects(6) = "fraMain" For x = 0 To 5        If objects(x).Enabled = True Then    objects(x).Enabled = False    End IfNext x

I done something like that above but have had no luck. Could someone please teach me how to get it working.

Alternatively, is there a simpler way that you can make all the controls within a frame enabled at once?

Load Multiple Objects At Runtime
i know this question has been answerd alot of times, but i cant find any of those when searching, do i load for example alot of commandboxes at runtime?

Applying Fonts To Multiple Objects
I have an application with like 100 different textboxes, listboxes, lables on about 5 different forms. Is there any way to change the font size, name, and etc. with the common Dialog control without having to list each individual textbox, listbox lable etc???

How To Reference Multiple Excel Objects
Had a question on how to reference multiple excel objects?

1.Open Excel file1 it excel file 2 it
5.close excel file2 access excel file1 object
Step 6 Fails
I am using the following functions for open and close excel
(objexcel,objworkbook & objworksheet are global variables)
public sub OpenExcel(sFileName)
Set objExcel = CreateObject("Excel.Application")
Set objWorkBook = objExcel.Workbooks.Open (sFileName)
Set objWorksheet = objWorkBook.WorkSheets(1)
public sub CloseExcel(sFileName)
Set objWorksheet=Nothing
set objWorkBook= Nothing
'Kill the instance of excel object
Set objExcel = Nothing

Selecting Multiple Objects In Code
as an output, if i want many objects to become disabled can i write the code for:

Image1 - Image78.enabled = false
Text2 - Text 6.visible = true.

Basically, i want to be able to write code for multiple objects that do the same output without having to write:

Image1.enabled = false
Image2.enabled = false
Image3.enabled = false...

etc etc etc.


Controlling Multiple Objects With A For Loop
Is there a way to create 5 texboxes and then control how many are enabled by using a comboBox?

Dim Counter
Dim myVariable

myVariable = comboExampleComboBox.listindex

For Counter = 1 to myVariable

txtExampleText(Counter).enabled = False


This code doesn't work, but it encompasses my idea. Any help would be greatly appreciated! Thanks!

looks like another bug...

Multiple WebBrowser Objects On One Form.
Well, now I seem to have another problem. Look at this code:

' Look for a certain string in an html document (searches the WHOLE doc)
Public Function LookForStringInDocument(cw As WebBrowser, lookFor As String, offset As Integer) As Boolean
    Set hel = cw.Document.body
    If Not (hel Is Nothing) Then
        If InStr(hel.innerHTML, lookFor) <> 0 Then
            LookForStringInDocument = True
            Set hel = Nothing
            Exit Function
        End If
        LookForStringInDocument = False
        Set hel = Nothing
        Exit Function
    End If
    LookForStringInDocument = False
    Set hel = Nothing
End Function

Trying to call it like this:
     If LookForStringInDocument(WB2, "You are not", 0) = true then
          MsgBox("We could not log on to our website!")
     End If

It seems that, when I pass the WB browser object (the webbrowser object doing the most work, the "primary" one on the form) to it, it works fine. But for the second web browser on my main form, it works approximately 1/10th of the time. It makes no sense as to why it would work fine sometimes, and not work the others. I have the page loaded in the second WebBrowser object (WB2), but it seems that it doesn't find the string. Yes, it is ghetto code, but it works for my purposes. I do not know why it would be working half-ass. Maybe someone can clarify for me? Thank you in advance.

- Brandon Erhart

"Inform all troops that communications are down!"

Multiple Instances Of Com Objects Hangs VB

I am working on python and VB. I have a com server on python which is a drawing application. I create an object in VB to start the application when I click on the menu in the form. If at a time only one instance of the application is crated then it works properly. If I open multiple instances of the application without closing the previous windows then also everything works fine until I close the MDI Form. When i close the MDI Form, the MDI Form closes but VB hangs.

Private Sub mnuHi_Click()
Dim a As Object
Set a = CreateObject("Python.Dhruv")
Set a = Nothing
End Sub

How can I prevent this??


Substitution Parameter For Creating Multiple Objects
I'm using the header fields from a csv file and a collection of User attributes from Active Directory to create a mapping form displaying the array of csv fields in one column and list boxes of the collection in the adjacent comlumn.

I want to programatically generate list boxes, each one with a suffix value that corresponds to the array index number for the csv column. So what I need to figure out is if there's a substitution parameter available in VB 6.0 that will read the counter variable in a For loop as a literal value.

Here's the concept in rather abbreviated logic
csvlist = ubound(csvfields)
For a in csvlist
Dim Listbox_"a" as Listbox 'Give index suffix so you create the temp objects
For Each ADattr in Usrattr.collection 'repeat

The intention is to provide flexibility to the form, as there could be varying numbers of header fields (20 to 30), so that the corresponding column pairs:
csv_header = listbox_value can then be written to a configuration file.

Thought this would be the easiest way to map a group of fix values to anothe r (the AD User collection) that has dozens of possible selections.

Failed To Create Multiple Word Objects VB6
Hi Everyone,

I'm working on a VB6 program which will process a selected word document. Anyway, I want to allow the users to work on some other MS word documents when the process is running. Because when i run my program, the process will take about 20 mins to finish, it's illogical to have the user waited for 20 mins without working on other Word-related works. I want the user to be able to multitasking.The problem i'm having now is when the user opens a another word document from Window Explorer, I get an error, because my program is trying to perform the actions on their selection on new opened word document.

So, is there anyway to ensure a new Word instance will be created when the user open another word Document? As you can see from the Task Manager, under normal circumstance, no matter how many word documents you open, only one "WINWORD.EXE" instance is being created and shared. I believe my problem will be solved if every word document opened is accompanied by a new Word object created.

The following is a small part of my code to create the Word object

Dim wrdApp As Word.Application
Dim wrdDoc As New Word.Document
Dim tempApp As Word.Application

If TypeName(wrdApp) <> "Application" Then
Set tempApp = CreateObject("Word.Application")
Set wrdApp = CreateObject("Word.Application")

Set tempApp = Nothing
End If

Set wrdDoc = wrdApp.Documents.Open(filePath)

Any help would be deeply appreciated. thanks..

Using Multiple Printer Objects To Print To Two Printers In VB App
I am trying to direct printer output to two different printers within the same app. In the end I need two printer files, one to a color printer and the other to a b&w one (the printing is done commercially, so we need to do this to save $$s).

Can I create a second printer object and then do something like this:

Printer1.print "text"
Printer2.print "text"

I have tried a few things to create these objects, but they don't seem to be working.

Thanks for the help.

Resolved - Multiple Objects Controlled By Same Code
If this turns out to be easy, I'm gonna shoot myself!

Here's the scenario...

I have an App (a good start?)

This app has several forms.

Virtually every one of the forms though has an object on it (a frame, but, I think irrelevant).

At various times when running the app I want to do stuff to the frame (move, colour etc) on the form with focus.

Is there ANY way I can put the code to do this (some of it is quite extensive) into a module and simply pass the form I want it to work on THIS time to the code so it works on the correct form.

I simply do not want to have 10 copies of identical code in my app.

Any thoughts??

Hope this makes sense!

Thanx in advance.


Sending MAIL To Multiple Receipients Using CDO Objects

I am using CDO objects for my EMAIL application. I want to send a MAIL to multiple receipients using then ( cc - carbon copy , bcc - Bi Carbon copy ) facilities.
I have provided two text boxes where user can enter several mail account names. I had written the code but it is not performing the activity what I wanted. It is taking
all the mail accounts along with the Main Receipient ( To mail Id ) in one line and the CC and BCC are left empty.

Code which I had written is as below

Set objRecipients = ObjMsg.Recipients

' This is for the main receipient to whom the message is to be sent
Set objOneRecip = objRecipients.Add

With objOneRecip
'Fill in an appropriate alias here
.Name = Me.TxtToMail.Text
.Type = ActMsgTo
.Resolve ' get MAPI to determine complete e-mail address
End With

Can u tell me how to change the logic for both CC and BCC




Multiple Opening...
Yes.. i need help w/ the Common Dialog. I wrote this code that allowed only one file at a time to be loaded into a llist box and be played in the media player.. then i searched a bit on the internet and i found this multiple file opener.. now.. i just need some help puting the write code together. Look at the first code i wrote.. then the second is the multiple file opener... Thanks for the help.. i cant wait to become active in this forum

First Code


Private Sub Command1_Click()
On Error Resume Next
CommonDialog1.Filter = "Audio Files|*.wav;*.mid;*.mp3;mp2;*.mod|"
CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.CancelError = True
CommonDialog1.DialogTitle = "Choose an mediafile to open"
CommonDialog1.FileName = ""

List1.AddItem CommonDialog1.FileName
List1.ListIndex = List1.ListIndex + 1
MediaPlayer1.FileName = CommonDialog1.FileName
Label1.Caption = CommonDialog1.FileName
End Sub

Code For Multiple Open


Private Sub Command1_Click()
Dim entries As Variant
Dim dir_name As String
Dim i As Integer

On Error Resume Next
If err.Number = cdlCancel Then
Exit Sub
ElseIf err.Number <> 0 Then
MsgBox "Error " & Format$(err.Number) & _
" selecting files." & vbCrLf & err.Description
Exit Sub
End If

entries = Split(CommonDialog1.FileName, vbNullChar)

' See if there is more than one file.
If UBound(entries, 1) = LBound(entries, 1) Then
' There is only one file name.
List1.AddItem entries(LBound(entries, 1))
' Get the directory name.
dir_name = entries(LBound(entries, 1))
If Right$(dir_name, 1) <> "" Then dir_name = dir_name & ""

' Get the file names.
For i = LBound(entries, 1) + 1 To UBound(entries, 1)
List1.AddItem dir_name & entries(i)
Next i
End If
End Sub

I want these things to happen when i open multiple items


List1.ListIndex = List1.ListIndex + 1
MediaPlayer1.FileName = CommonDialog1.FileName
Label1.Caption = CommonDialog1.FileName

Hope you can help thanks...

How To Connect Events Of Multiple Objects To One Event Handling Function?
Hi, Gurus
Please help me with this. I've been doing research for a few days but haven't got a solution. In my case, I need to create several objects of the same type. The object generates a few events need to be handled. I need to create the objects dynamically at runtime.

Now is my question. How can I connect the events with the event handing functions using WithEvents? With WithEvents, I can connect the event of a particular object with a function at design time. But I need to create the object at runtime.

I know with control array I can trap events generated by multiple objects with only one handler. (sorry, I don't know how to name the variable declared by WithEvents) But it seems to me control array only handle activex components. May I create control array at runtime? I am quite confused.

Sorry for so many questions. I was mainly working in C++ before and haven't been adjusted right for VB yet. But I have to work out the project on my own with tight schedule. If someone can help me out, I really appreciate that.

Opening Multiple Files...
I have problems using the CommonDialog control to open files. I want the user to be able to select multiple files, then the program to 'open' each of these files and add them to a list. (it is actually a music browser in my editor, so that designers can test out the music from a list).
I've set the CommonDialogObject.Flags = (cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNFileMustExist Or cdlOFNHideReadOnly).
But when the call returns the filename only contains the path, and I don't see where to read out the actual file names ...I though it would return each filename enclosed in quotes so that one could read them out with a scanning loop. Suggestions?

Opening Multiple Files In VB6
I need some help troubleshooting what should be a simple problem. I'm trying to open files in VB6. The first file opens properly. The second file "doesn't exist". What I've tried so far:

1 - the file exists
2 - the file opens in notepad
3 - recreated the file in case it was corrupt
4 - checked security settings (Everyone=Full Access, at both share and file level)

The code looks like this:

'Assemble paths
Label5.Caption = "Assemble Paths"
strPath = "\" + Text1.Text + "" + Text2.Text + "" + Text3.Text
strPathOut = "\" + Text1.Text + "" + Text2.Text + "" + Text4.Text
strPathComp = "\" + Text1.Text + "" + Text2.Text + "" + Text5.Text

'Parse Comparison file
Label5.Caption = "Parse Comparison File"
intFileComp = FreeFile

Open strPathComp For Input As intFileComp
If Err Then
strMissingPath = strPathComp: GoTo NoFile
End If

intLoop1 = 1

Do While Not EOF(1)
Line Input #intFileComp, strFileCompLine
arComp(intLoop1) = strFileCompLine
intLoop1 = intLoop1 + 1
intDummyVar = MsgBox(FreeFile, vbOKOnly, "File Missing")

Close intFileComp

intCompElements = UBound(arComp)

'Open report file
Label5.Caption = "Opening " + strPath
intFileIn = FreeFile
Open strPath For Input As intFileIn
If Err Then
strMissingPath = strPath: GoTo NoFile
End If

Opening Multiple Files
I'm new to VBA. Here's what I'd like a macro to do, but don't know how to get started coding it:

1. Open or read each Word doc in a specific directory (doesn't matter if user gets prompted for this or if the path is hard-coded in the macro).

2. For each doc found, do something with the doc (such as Save to HTML--if possible, saving to a different folder than where the Word docs reside would be useful--for example, a C:Word directory for the Word files and a C:HTML directory for the HTML files, or input/output folders on C.

3. Close each doc (assuming they have to be opened in the first place).

I can do this for 1 doc just by recording a macro, but I don't know how to add the code to make the macro loop through all files in a given directory.

Thanks in advance.

Opening Multiple Documents

I have code that uses late binding to create Word documents

The code looks like this:

Sub opens

On Error Resume Next

Dim oDoc, oMSOffice As Object

Set oMSOffice = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set oMSOffice = CreateObject("Word.Application")
End If

With oMSOffice.Documents
.Open FileName:="one.doc", Visible:=False
Set oWd = .Open(FileName:="two.doc", Visible:=True)
End With

oMSOffice.Visible = True
Set oMSOffice = Nothing
End Sub

The problem I'm having, is that whenver the Word application becomes visible, the focus goes to the FIRST document opened, when the Activate call is meant to set the focus of MS Word to the LAST document opened. (i.e., in the above example, the focus should be on two.doc instead of one.doc.

Is there an extra step I'm missing?

Opening Multiple File

I have created a program where I can select a file from a directory and it opens another program for me. Is it possible to select a directory and have all the files in that directory sent to the other program one at a time.

Can anyone help.

Opening Multiple Files
Sorry I am a novice just learning, so pardon my ignorance. I am trying to load the files names of multiple files (using microsoft commmon dialog contols.showopen) in to an array. Can someone please point me to the right direction please, Thanks in advance.

Opening Multiple Recordsets
I am trying to loop through one recordset...and within that loop open another recordset and loop through that recordset.

I am getting an error when I try to open the second recordset. The error is:

"Run-time error '3705':
Operation is not allowed when the object is open"

and it occurs on the line:

"Reportrs.Open Reportsql, sConn, adOpenForwardOnly, adLockPessimistic, adCmdText"

Here is the code:

Public Sub Writearchive(myId As String)
Dim rs As New ADODB.Recordset, sql As String
Dim Reportrs As New ADODB.Recordset, Reportsql As String
Dim Path As String
Dim ContactID As String

Dim sConn As String
Dim ReportsConn As String

sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "HearthHomeHearthHomeVend.mdb" & ";Persist Security Info=False"

'This is the SQL statement that we will use to select the record.
sql = "SELECT Name, CompanyContactName, Phone, Fax, Email, ContactID " _
& "FROM CompanyContactReports " _
& " ORDER BY CompanyContactName"
'open the recordset
'in this case we need to use the adOpenForwardOnly cursortype because we are just
'reading the recordset.
'We use the adLockPessimistic recordlock because we do not what anybody else to change
'the record while we are reading it.
rs.Open sql, sConn, adOpenForwardOnly, adLockPessimistic, adCmdText
While Not rs.EOF
ContactID = rs!ContactID

Label3.Caption = Label3.Caption & "Name: " & rs!CompanyContactName & vbCrLf
Label3.Caption = Label3.Caption & "Phone: " & rs!Phone & vbCrLf
Label3.Caption = Label3.Caption & "Fax: " & rs!Fax & vbCrLf
Label3.Caption = Label3.Caption & "Email: " & rs!Email & vbCrLf & vbCrLf

Reportsql = "SELECT ContactID, ReportName, ReportType, Date_Time " _
& "FROM CompanyReportsQuery WHERE ContactID='&ContactID&'" _
& " ORDER BY ReportName"

Reportrs.Open Reportsql, sConn, adOpenForwardOnly, adLockPessimistic, adCmdText

While Not Reportrs.EOF
Label3.Caption = Label3.Caption & "Reports Needed: " & Reportrs!ReportType & "," & Reportrs!ReportName & "," & Reportrs!Date_Time & vbCrLf


Set rs = Nothing

End Sub

I can't figure out what is wrong. Does it have to do with my connection string??

Thanks in advance for any help


Opening Multiple Files
I'd like to know how to open all files from a folder at the same time.

I want to open a folder full of mp3s through wmplayer but I can only get 1 at a time to work

This is the code I've used to get 1 song to work at a time.

VB Code:
Option ExplicitPrivate Sub Command1_Click()openPath ("""C:Musicsong.mp3""")End Sub Public Sub openPath(path As String)Shell "C:Program FilesWindows Media Playerwmplayer.exe " & path, vbNormalFocusEnd Sub

Any help would be greatly appreciated

Opening Multiple Forms
I'm pretty new to VB and I was wondering if there is a way to load a form multiple times. I have a project with 2 forms. In the first the user enters a search keyword and they clicks on a site they wish to search. In the second the site is displayed. Now, I want to know if it is possible to load the second form more then once so the user can have multiple search pages open.


Opening Multiple Files
I am trying to write a macro in Excel to copy data from a same cell in several different spreadsheets. All of the spreadsheets are located in the same folder in my computer. The spreadsheets are named 2006-00001, 2006-00002, 2006-00003, ...., 2006-99999. To complete this task, I am trying to do a loop to open each spreadsheet:

For i=1 to i=9:
Workbooks.Open Filename:= _
"\brasms115wwreportsIn Process20062006-0000" i ".XLS", UpdateLinks:=0

For i=10 to i=99:
Workbooks.Open Filename:= _
"\brasms115wwreportsIn Process20062006-000" i ".XLS", UpdateLinks:=0


However, I am getting the following error with reference to the i:
Compile error:
Expected: end of statement

Does anyone know the proper way to do this?
Any and all help much appreciated!

Thank you,

Opening Multiple Files At Once
How would this be possible (with the common dialog box)

I know other programs let you select more than one file from the dialog box. How would you do this in vb? I tried clicking with control held down, but that didn't work.

Also, is there a way you can resize a picture box at runtime with the mouse? Or does anyone know of a control that would let you do this?

Opening Multiple Files..

I just made a temporary app to test this with, but I still can't figure it out.

lets say I open a file, into my app.

the command$ comes up as:

but if I want to do something with it, I go open command$ for input as #1

now, lets say I open 2 apps.
I have a problem. Command$ comes up as:
C:MyFile.txt C:Autoexec.bat '

How can I loop through all the files in the command$??

I thought of trying this:

Dim FileList() as string

FileList = split(command, " ")

but if there is a space in the filename, again, I have a problem.

How can I get around this??
(btw this is the last part to my app...)

Help is VERY MUCH appreciated!


Opening Multiple Files
Is it posssible (i think it should) to open multiple files, i keep getting a file already open warning even though i have give different file id for each file, CAN ANYONE HELP?

Many Thanks

Opening Multiple Databases
In VB6 I have to accommodate users to open the database of their choice, but
since the scripting text differs from connection string to connection
string, how would I provide each user the ability to pick his type of
database without maintaining a huge select block and hardcoding it.

Currently I have a dropdown box with the databases that are available and
upon clicking on a database, I populate a listbox with possible choices,
ODBC, OLEDB and so on. Then, if the user clicks on a connection type, I
present a sample connection string in a text box, which the user can edit
and save. But the object creation scripts differ somewhat from platform to
platform and my app can be run on anything that will accommodate VB.

Any ideas?


Opening Multiple Files
Is there any object like commondialog.showopen which lets me open many files at a time for manipulation . In simple words the functionality of ctrl + selecting a file.

Opening Multiple Application
I have a vb application where one EXE calls another exe, so that a new application opens. But when i want to open the same application again from the other application it gives an error that the application is already active and the new instance is not opened. I use SHELL function to open the exe. Needs help. Thanks in Advance.

Opening And Saving Multiple Files
I'm attempting to write a program that will automatically open files in a given directory, perform some operations (this part I have) and then save the modified file using the same directory structure and name but on a different server. The problem is that there is no pattern to the files to be opened. Except that the folders have dates on them. Inside the folder there is a random number of files that are named randomly. This program is supposed to run in the background at all times. I'd appreciate any help you can provide.

Opening Multiple Files And Merging.
Ok Im trying to open all of the text files in a directory then merge them into one file.

Right now I can open 1 file do some editing then create a new one.

But I want to be able to open all txt files in a directory without knowing the names then just make 1 master file of all of them merged. Im not sure how to do this Ive tried wild cards and I dont have help files. Any help would be appreciated!

Open *.txt for input #1

dosent work. Im not sure how to use wild cards with vb6. I do realize I cant open them all under the same file number at the same time but Im just not sure how to go about this.

Thanks in advance.

Opening Multiple Files W/ GetOpenFileName
Apparently, I am doing something wrong.

I am attempting to let the user select multiple file names with the GetOpenFileName method.

Dim vFile As Variant, vFile2 As Variant

vFile = Application.GetOpenFileName(FileFilter:="Excel Files (*.xls),*.xls",MultiSelect:=True)
'So far so good

For Each vFile2 In vFile 'generates an error
i = UBound (vFile) 'Also generates an error

What am I doing wrong? This seems easy, but...

Opening Multiple Files With GetOpenFile
I am trying to open multiple files with GetOpenFile...Iam new to this effort; but, I have researched this and other forums as well as reviewed MS Help. I have set the MultiSelect Option to "True"...but, clearly I'm missing something as I can only open up one file...

Any assistance, as always, would be greatly appreciated

ChDir "P:Folder1Folder2Folder3Folder4File1_" & TextBox1.Text & ".csv"
fileToOpen = Application _
.GetOpenFilename("CSV Files (*.csv), *.csv", 3, , , True)
If fileToOpen <> False Then
MsgBox "Open " & fileToOpen
Workbooks.Open fileToOpen, False, True
End If

Opening Multiple Files In Same Workbook
I'm trying to open multiple one page files into one workbook. I could loop through them all opening them individually but i dont know how to loop through individual files by filename other than naming then 1,2,3, etc and using a loop.

Please let me know if you can help me out.


Opening Multiple .txt Files On Different Worksheets

I'm Using Excel 97.

I wonder if someone can help me or point me in the right direction.

I have a number of tab delimited .txt files in different directories. I need to open each one within the same workbook but with each on a different worksheet.

I found a thread that does the same as i need to do but i am not sure what should go instead of the Data_From_File part ? Also very annoyingly my help files do not seem to work so i cannot even check the correct syntax in there.

any help appreciated


Copyright 2005-08, All rights reserved