Call of macros in modules via .vbs file

mos

New Member
Joined
May 8, 2011
Messages
15
hey guys,

I got the following setup:
icAAXs.png


I would like to execute this macro "updateNexportOpen" without Opening the xls file AND without using Workbook_Open event.

so I came across this code which I execute via a .vbs file

Code:
Dim objXL
Set objXL = CreateObject("Excel.Application")

on error resume next

With objXL 

    .Workbooks.Open ("Y:\...\DB saved.xls") 
    .Run "DB saved.xls!updateNexportOpen" 
    Application.Calculate
    .Quit

End With

Set objXL = Nothing

This seems quite good, as far as something happens (sandglass) AND Excel asks me "Do you want to save the changes?"
BUT this comes very fast, usually the 2 web queries take longer.

so maybe it doesnt execute anything and it does not save a text file, which it usually does. (neither I click save changes nor dont save changes).

so it probably does not execute the macro, even though it has some changes inside the file.

Someone has an idea what could cause that?

Thanks and regards,

mos



P.S. same macro works perfectly executed inside the xls with a butt*******
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
the line

Code:
.Run "DB saved.xls!updateNexportOpen"

is supposed to be

Code:
.Run "updateNexportOpen"

with this only change it works.

maybe because the macro is in a module it is called in the application-universe instead calling it via the workbook.

cheers
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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