View Single Post
  #10   Report Post  
Posted to microsoft.public.scripting.vbscript,microsoft.public.excel.programming
[email protected] karenmiddleol@yahoo.com is offline
external usenet poster
 
Posts: 13
Default How to create a self extracting zip file that starts excel with a macro

Hi Miyahn

Here is the script changes I did:

Const DESTROOT = "C:\TEMP\" ' Install Target


and the following is the setup.vbs

With CreateObject("Excel.Application")
.Visible = True
.Workbooks.Open "C:\temp\test.xls"
End With


In c:\temp\scr2 I have the CreateCAB.vbs file and in c:\temp\scr I have
the test.xls and test.mdb as well as the setup.vbs.

I drag and drop c:\temp\scr onto c:\temp\scr2\createcab.vbs

and it created c:\temp\scr.exe when I run scr.exe looks like it is
running setup.vbs
but it throws the following errors:

script: c:\temp\scr\setup.vbs
line 3
char 3
Error: c:\temp\test.xls could not be opened.

When I check c:\temp for the files test.xls and test.mdb which the CAB
creation script must first place it there and then start setup.vbs
looks like the script did not put the .xls and .mdb file in c:\temp

Also, instead of dragging and dropping the folder to be packaged onto
createcab.vbs script can you please let me know what changes I must do
to it so I can run in batch and specify say a command line argument of
the folder to be packaged and the destination and file name of the .exe
file.

Thanks
Karen


Miyahn wrote:
wrote in message oups.com
Hi Miyahn

I can see the script you have posted today I could not see it
yesterday.

But the script is so big not sure where I need to make changes and what
changes.


Hi Karen,

The only line you must change is the line declaring constant DESTROOT.
| Const DESTROOT = "C:\Program Files\" ' Install Target

All I have is a file test.xls which the pivot report against a Access
database testdb.mdb.


Here are two sample code for 'Setup.vbs'.
1: Open specified Excel file and run macro.
With CreateObject("Excel.Application")
.Visible = True
.Workbooks.Open "C:\temp\srcfolder\test.xls" ' <-need modify this line
.Run "macroname", arg1, arg2 ' <-need modify this line
End With

2: Open the installed folder by Explorer.
Const DESKTOP = &H0
With CreateObject("Shell.Application")
.Explore .NameSpace(DESKTOP).ParseName(WScript.ScriptFullNa me).Parent
End With

Do users need to have WSH installed on their PC for this to work how
can they
open the CAB file with what application ?


There are no need of WSH to execute self-extracting cabinet file.
Extracting can be done on Win95 or lator.(not sure)

But if you use post-setup script (Setup.vbs), users need to have WSH
installed on their PC.

--
Miyahn (Masataka Miya****a) JPN
Microsoft MVP for Microsoft Office - Excel(Jan 2005 - Dec 2005)