Excel + COM+

Nalij_isPower

New Member
Joined
Aug 16, 2007
Messages
3
Excel + COM+
1. I am trying to code the Autofilter process in my script using COM+.
I can open autofilter, how do you select? The VB code does not work for COM+.
2. Is there a site with examples for scripting Excel with COM+?
3. Is there a site that show the difference in the commands needed to code Excel COM+ vs Excel VB?

Below is the code I am trying to use.

Dim ExcelApp,ExcelBook,ExcelSheet as variant
Dim Field, Criteria1 as string
Dim BULDNME as string
BULDNME="D"
.
.
.
ExcelBook.WorkSheets("Sheet2").Range("a:a").AutoFilter ' Autofilter on
ExcelBook.WorkSheets("Sheet2").Range("a:a").AutoFilter Field:=1,Criteria1:=BULDNME

Thanks for your time.
D.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hello, welcome to MrExcel. :)

No need to select anything, the following should work just fine with VB6:

Code:
Sub foo()
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Add
With xlApp.Workbooks(1).Worksheets(1)
    Let .Range("A1:A6").Value = _
        xlApp.[{"Test";1;2;1;2;1}]
    .Range("A:A").AutoFilter 1, 1
End With
xlApp.Visible = True
Set xlApp = Nothing
End Sub
Yes-no? :wink:
 
Upvote 0
Thank you for your response,
I am learning as I go, I am a beginner with VB + Com+
Is VB6 the same as COM+,

The example did not work for me. I got the error message unexpected Token Expected: -=

I am using a client based (GUI) application, which has the ability to interface with Excel using COM+.

I am also waiting for a call back from our vendor on this question.

Thanks
D
 
Upvote 0
FYI,

The following worked:

Field = 1
SelectionCriteria = "Dana"

ExcelBook.WorkSheets("Sheet2").Range("A1:A6").AutoFilter(Field, SelectionCriteria)
 
Upvote 0
So, the only difference is that you need ()s for the arguments? All righty then. Don't try that with VBA... :confused:

Thanks for following up and glad to hear this is sorted. :)
 
Upvote 0

Forum statistics

Threads
1,213,521
Messages
6,114,104
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top