LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel VBA - choosing another Excel application

Hi Georg
try the following: Opens a different workbooks, put some infos in the
first sheet, saves the wbk and closes it

Option Explicit

Private Sub open_save_other_wbk(Cancel As Boolean)
Dim log_wbk As Workbook
Dim log_wks As Worksheet
Dim last_log_row As Long
Dim path As String
Dim log_filename As String
Dim source_wbk As Workbook
Dim source_wks As Worksheet


'Initialization
Application.ScreenUpdating = False
path = "D:\Temp\"
log_filename = "log.xls"
Set source_wbk = ActiveWorkbook


'check if logging workbook is open / if not open it
On Error Resume Next
Set log_wbk = Workbooks(log_filename)
On Error GoTo 0
If log_wbk Is Nothing Then
Workbooks.Open filename:=path & log_filename
Set log_wbk = Workbooks(log_filename)
End If
Set log_wks = log_wbk.Worksheets("sheet1") 'change this

'get last used row
last_log_row = log_wks.Cells(Rows.Count, "A").End(xlUp).row

'log data - change to your needs
With log_wks
.Cells(last_log_row + 1, 1).Value = Application.UserName
.Cells(last_log_row + 1, 2).Value = _
Format(Now, "MM/DD/YYYY hh:mm:ss")
End With


' save the changes
Application.DisplayAlerts = True
log_wbk.Save
log_wbk.Close
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub




--
Regards
Frank Kabel
Frankfurt, Germany

How can I in a macro run in one Excel application select an workbook
running in another Excel appl. and save this workbook?

Thanks in advance

Georg Rokne


---
Message posted from http://www.ExcelForum.com/


 
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
excel 2003 drop down time choosing skeptic007 Excel Discussion (Misc queries) 1 December 28th 06 03:22 PM
In an excel cell,choosing a value,similar to combobox in VB - reg Thirumalai New Users to Excel 2 March 30th 06 11:04 AM
Excel formula(?) for choosing only 1 cell.. cjtj4700 Excel Discussion (Misc queries) 1 November 24th 05 10:36 AM
Dropdown Selections in Excel - creating and choosing Abi Excel Worksheet Functions 2 January 7th 05 02:27 AM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM


All times are GMT +1. The time now is 03:10 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"