473,498 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open/Save Excel Sheet - Force it to save to a specific directory

7 New Member
Hi all,

As with all database developments I keep getting more and more requirements piled on me and was hoping that someone could help me out with this one as it is outside my knowledge!!!

One of my forms shows project information and has the capability of browsing and attaching files to the current record (works fine). There is a command button that opens up a template excel file that we use in the office, this is were I get lost!

The excel form opens up fine but I have been asked if I can automatically force the excel file to save to the correct place (I have a filing system that attached documents are saved to) once the user has finished with it.

I have absolutely no idea if this is possible as I have never tried anything like this before!

Any help, even if it is just a confirmation that this is beyond the capability of access, is most appreciated!!

Cheers

Phil
Jun 13 '07 #1
4 6459
FishVal
2,653 Recognized Expert Specialist
Hi all,

As with all database developments I keep getting more and more requirements piled on me and was hoping that someone could help me out with this one as it is outside my knowledge!!!

One of my forms shows project information and has the capability of browsing and attaching files to the current record (works fine). There is a command button that opens up a template excel file that we use in the office, this is were I get lost!

The excel form opens up fine but I have been asked if I can automatically force the excel file to save to the correct place (I have a filing system that attached documents are saved to) once the user has finished with it.

I have absolutely no idea if this is possible as I have never tried anything like this before!

Any help, even if it is just a confirmation that this is beyond the capability of access, is most appreciated!!

Cheers

Phil
It is definitely possible and quite easy to do. Plz provide me the code of the button used to open Excel template.
Jun 13 '07 #2
PhilOwens
7 New Member
It is definitely possible and quite easy to do. Plz provide me the code of the button used to open Excel template.
Cheers....I was hoping that it was possible but wasnt holding my breath!

Code below opens the template file.

Private Sub Template_Click()

template_filepath = "\\UK\Main\Projects\templates\Blank_Comments.x ls"
FollowHyperlink (template_filepath)

End Sub
Jun 13 '07 #3
FishVal
2,653 Recognized Expert Specialist
Cheers....I was hoping that it was possible but wasnt holding my breath!

Code below opens the template file.

Private Sub Template_Click()

template_filepath = "\\UK\Main\Projects\templates\Blank_Comments.x ls"
FollowHyperlink (template_filepath)

End Sub
Ok.

I'm not sure whether you can do it opening XL file via FollowHyperlink.

Here is another solution. It works fine.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Option Compare Database
  3. Const FolderToSaveTo = "C:\Temp\"
  4. Const TemplatePath = "C:\template.xls"
  5.  
  6. Private Sub Template_Click()
  7.  
  8.     Dim appExcel As Excel.Application
  9.     Dim wkbWorkBook As Excel.Workbook
  10.  
  11.     On Error Resume Next
  12.  
  13.     Set appExcel = CreateObject("Excel.Application")
  14.  
  15.     With appExcel
  16.         .UserControl = True
  17.         Set wkbWorkBook = .Workbooks.Open(TemplatePath)
  18.         If Err <> 0 Then
  19.             MsgBox "Template file not found", vbOKOnly + vbCritical, "Error"
  20.             .Quit
  21.             GoTo ExitSub
  22.         End If
  23.         .Visible = True
  24.     End With
  25.  
  26.     wkbWorkBook.SaveAs FolderToSaveTo & UniqueName & ".xls"
  27.  
  28. ExitSub:
  29.     Set wkbWorkBook = Nothing
  30.     Set appExcel = Nothing
  31.  
  32. End Sub
  33.  
  34. Private Function UniqueName() As String
  35.     UniqueName = "CreatedOn - " & Format(Now, "mmm-dd-yyyy hh-mm-ss")
  36. End Function
  37.  
  38.  
Define your paths in rows 2,3

Good luck.
Jun 13 '07 #4
PhilOwens
7 New Member
What can I say other than thanks!!

Works a treat.

Cheers FishVal, you saved me from one hell of a headache!
Jun 13 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
35479
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
4
5070
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
6
6741
by: Daniel | last post by:
Hi all, Can i open and edit the excel sheet on web page after downloading? After editing, i close the web page and the excel file auto upload to the server. Is it possible? I really struggling...
3
7412
by: Jennyfer Barco | last post by:
Hello, I have a question, how can I open Microsoft Excel from .NET. I only need to open a new file in Excel and paste some information and set the Microsoft Excel as the enabled aplication, so the...
3
4818
by: pleaseexplaintome_2 | last post by:
using the code below (some parts not included), I create a new excel workbook with spreadheets. I then want to delete a spreadsheet, but a reference remains open and excel stays in task manager...
1
7789
by: msanger | last post by:
Hi, I have several excel sheets in Office 2007, which has all kinds of standard calculations, and a consolidated Excel Sheet with totals and rollup of all the other excel files. The issue I am...
0
2239
by: Vader | last post by:
I am new to this forum. Thanks in advance for and help. The following is what I am looking for: 1. I need help with VB code to open a MS Word (.doc) file. 2. Read lines from the MS Word (.doc)...
2
4331
by: kunalgujar | last post by:
I am using ASP to open a excel file. I've noticed that Internet Explorer adds a number in square brackets to files downloaded from the internet and opened directly (i.e. by clicking 'Open' and not...
1
1577
by: flickimp | last post by:
Hi I have an excel file with 20 sheets. Now then... I am only interested in one Sheet (2 pages) and I want to save that to a particular folder. Also, the sheet is dependent on Cell D7...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.