Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Automating Access / Excel with batch file

I'm trying to automate a process involving Access and a linked Excel
spreadsheet that is protected with a password. My approach is to build a
batch file that will open an Excel (2003) spreadsheet and execute a macro
that unprotects the sheet, saves and closes it thereby allowing the batch
file to run the Access code (which updates the spreadsheet file), and finally
run another Excel macro to protect and save the changed Excel file.

Can this be done with command line switches / options? Am I asking the
impossible? Is there a betterway? Thanks.
--
Art
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Automating Access / Excel with batch file

Why not just open the Excel spreadsheet and drive the whole process from your
Workbook_Open procedure? You can automate Access from your Excel VBA code
(or vice-versa) and you would never need to close, save, and reopen Excel,
plus much greater flexibility than you could do with batch files and command
line switches. You can keep the whole process hidden (invisible to the user)
if desired.

If you have not used automation, the basic idea is to include a reference to
the Access object model in your Excel project, then you can create an object
variable to contain a whole Access session:
Dim AccessApp as Access.Application
You can then use all the VBA code you would normally use from Access if you
remember to put AccessApp.___ ahead of all your base objects. Too much to
teach in a quick response, but you can find lots of info by searching MSDN on
the topic of automation.

"Art" wrote:

I'm trying to automate a process involving Access and a linked Excel
spreadsheet that is protected with a password. My approach is to build a
batch file that will open an Excel (2003) spreadsheet and execute a macro
that unprotects the sheet, saves and closes it thereby allowing the batch
file to run the Access code (which updates the spreadsheet file), and finally
run another Excel macro to protect and save the changed Excel file.

Can this be done with command line switches / options? Am I asking the
impossible? Is there a betterway? Thanks.
--
Art

  #3   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Automating Access / Excel with batch file

Well, that certainly puts a new twist on things. I'll try that next week.
Thanks.
--
Art


"K Dales" wrote:

Why not just open the Excel spreadsheet and drive the whole process from your
Workbook_Open procedure? You can automate Access from your Excel VBA code
(or vice-versa) and you would never need to close, save, and reopen Excel,
plus much greater flexibility than you could do with batch files and command
line switches. You can keep the whole process hidden (invisible to the user)
if desired.

If you have not used automation, the basic idea is to include a reference to
the Access object model in your Excel project, then you can create an object
variable to contain a whole Access session:
Dim AccessApp as Access.Application
You can then use all the VBA code you would normally use from Access if you
remember to put AccessApp.___ ahead of all your base objects. Too much to
teach in a quick response, but you can find lots of info by searching MSDN on
the topic of automation.

"Art" wrote:

I'm trying to automate a process involving Access and a linked Excel
spreadsheet that is protected with a password. My approach is to build a
batch file that will open an Excel (2003) spreadsheet and execute a macro
that unprotects the sheet, saves and closes it thereby allowing the batch
file to run the Access code (which updates the spreadsheet file), and finally
run another Excel macro to protect and save the changed Excel file.

Can this be done with command line switches / options? Am I asking the
impossible? Is there a betterway? Thanks.
--
Art

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can excel run a batch file? Tom Excel Discussion (Misc queries) 2 June 1st 09 02:46 AM
Excel to Run a Batch File?!? carla New Users to Excel 3 January 20th 07 02:32 AM
Run a batch file from Excel Tempy Excel Programming 7 May 18th 05 01:41 PM
Automating Access from Excel quartz[_2_] Excel Programming 2 May 11th 05 09:36 PM
Create a batch file from a number of Excel File Vinay[_2_] Excel Programming 0 September 8th 04 01:11 AM


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"