LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default inputbox to import file

Greetings,

Target: append data to a table from a daily file is saved in a folder
with name and date, "fileYYMMDD.csv"

Problem: "sometimes" the sub-routine works, others doesn't: 1004 Run
time Error, the file could not be found. In my laptop works flawlesly,
and in the office sometimes works but I coun't not isolate the variable
to determine the bug. Would you please help me with this challenge?
Thank you.

This is the routine I am using:

Sub Name()
Dim NextRow As Long
NextRow = Range("B65536").End(xlUp).Row + 1
mybook = InputBox("Enter File Name to Open:", "imYYMMDD.csv
Format")
If mybook = "" Then Exit Sub
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Open FileName:=mybook
ChDir "C:\Whatever path\Folder"
Range("B1:B10") = "=Today()*1"
Range("B1:D10").Copy
Workbooks(mybook).Close
ThisWorkbook.Activate
Cells(NextRow, 2).Select
ActiveSheet.Paste
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 I import text file of cash flow to excel file then use formula Bumpa Excel Discussion (Misc queries) 2 May 28th 10 04:22 PM
How do I import text file, analyze data, export results, open next file Geoffro Excel Programming 2 March 6th 05 08:02 PM
Import Data with the filename coming from inputbox ? Iceage Excel Programming 1 November 24th 04 03:22 AM
inputbox vs. userform/combobox vs. Windows file handlers ??? List Lurker Excel Programming 2 October 12th 04 11:19 PM
Import text file into excel with preset file layout, delimeters VBA meldrape Excel Programming 7 June 15th 04 08:31 PM


All times are GMT +1. The time now is 03:34 PM.

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

About Us

"It's about Microsoft Excel"