LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Using filename retrieved from GetOpenFilename

I am trying to write a macro that will use one file to update another. I got
some test code to work the way I wanted, but I need to user to select the
target file, and that is causing trouble.

Here is what I have so far:
Option Explicit
Sub auto_open()
Dim FileName As Variant
Application.ScreenUpdating = False
FileName =Application.GetOpenFilename(MultiSelect:=False)
Workbooks.Open FileName
Workbooks(FileName).Worksheets("Sheet1").Unprotect Password:="password"
ThisWorkbook.Worksheets("Sheet1").Activate
ActiveSheet.Cells.Copy
Workbooks(FileName).Worksheets("Sheet1").Range("A1 ").PasteSpecial
Workbooks(FileName).Worksheets("Sheet1").Activate
ActiveSheet.Range("A1").Select
Workbooks(FileName).Worksheets("Sheet1").Protect Password:="password"
Application.CutCopyMode = False
Application.ScreenUpdating = True
ThisWorkbook.Close savechanges:=False
End Sub


 
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 the author of an .XLS be found and retrieved ? HTTC guy Excel Discussion (Misc queries) 1 July 14th 06 05:01 PM
GetOpenFilename not returning a usable variable Lilivati Excel Discussion (Misc queries) 2 June 26th 06 09:02 PM
vlookup with more than number to be retrieved martelie Excel Worksheet Functions 3 October 14th 05 12:50 PM
vlookup with more than number to be retrieved martelie Excel Worksheet Functions 1 October 8th 05 07:33 AM
Filter Count of Records Retrieved. amkazen Excel Discussion (Misc queries) 2 March 31st 05 10:03 PM


All times are GMT +1. The time now is 06:16 AM.

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"