+ Reply to Thread
Results 1 to 3 of 3

.VBS to download workbook daily

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    .VBS to download workbook daily

    I consistently update and make changes to a workbook contaning userforms with automation controls. My VBS to launch the workbook is shown below:

    Option Explicit 
     
    On Error Resume Next 
    
    ExcelMacroExample 
     
    Sub ExcelMacroExample()  
     
      Dim xlApp  
      Dim xlBook  
     
      Set xlApp = CreateObject("Excel.Application")
      xlapp.visible = "false"  
      Set xlBook = xlApp.Workbooks.Open("C:\Documents and Settings\jbayldon\Desktop\CASautomation\CASautomation.xlsm", 0, False)  
      
      xlApp.Run "CallForm"
    
      xlApp.quit
     
      Set xlBook = Nothing  
      Set xlApp = Nothing  
     
    End Sub
    What I want to do is store a workbook on a network drive and then download it into a local directory daily through my vbs file. This workbook supports password management for users, and is required to be read/write, so I dont want to access it directly from the drive share. How would I go about making these changes?
    Last edited by jayinthe813; 10-24-2012 at 12:41 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: .VBS to download workbook daily

    You could use the FileSystemObject's CopyFile method, something like this:
    Dim FSO
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FSO.CopyFile "X:\folder\subfolder\Workbook.xls", "C:\Your\Desktop\subfolder\", True  'X network drive letter
    set FSO = nothing
    Post responsibly. Search for excelforum.com

  3. #3
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: .VBS to download workbook daily

    +rep. thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1