Running commands in ThisWorkBook when opening excel from a vbscript fails

MadsLeDanois

New Member
Joined
Dec 18, 2006
Messages
3
I have a very strange problem with Excel.

In Excel VBA I use ThisWorkBook to run some initial commands at start up for example:

Private Sub Workbook_Open()
With Application
.ScreenUpdating = False
.DisplayFormulaBar = False
.DisplayStatusBar = False
.ScreenUpdating = True
.WindowState = xlNormal
.Width = 865
.Height = 740
.CommandBars("Drawing").Visible = False
End With
End Sub

If I open the Excel workbook directly it works perfect and run these commands, but if I open it from a vbscript with these commands:

Set aa=createobject("Excel.Application")
aa.Workbooks.Open "C:\Test.xlsm"
aa.visible = true
Set aa = nothing

It will not run the commands in ThisWorkBook at startup.

It works fine with Windows XP, 7 and even 8 together with Office Excel 2010, but not on Windows 8.1 (not sure if this matters).

Do anybody know a workaround or a setting of some kind which can cause this?

Kind regards
Mads
 

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