A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Changing a csv file opened as hidden workbook



 
 
Thread Tools Display Modes
  #11  
Old June 27th 12, 12:57 AM posted to microsoft.public.excel.programming
GS[_2_]
external usenet poster
 
Posts: 2,251
Default Changing a csv file opened as hidden workbook

Sorry.., I wasn't paying close enough attention when I was fitting the
post to avoid word wrap! Revise the code as follows...

Sub EditHiddenWkb()
Dim wks As Worksheet, wkb As Workbook
Dim vAns As Variant, sMsg As String

Set wkb = Workbooks("my.csv"): Set wks = wkb.Sheets(1)
With wkb
'Get the position to insert a new row,
'and the label of the column to delete.
sMsg = "Enter the row number position to insert the new row AND " _
& "the label of the column to delete, separated by a comma." _
& vbCrLf & vbCrLf & "Example: 2,B "
vAns = InputBox(sMsg)
If vAns = False Then Exit Sub '//user cancels

'Insert row and delete column
vAns = Split(vAns, ",")
With wks
.Rows(vAns(0)).Insert shift:=xlDown: .Columns(vAns(1)).Delete
End With 'wks

'Confirm success
Windows(wkb.Name).Visible = True
sMsg = "Do you want to save the changes to " & wkb.Name & " ?"
vAns = MsgBox(sMsg, vbYesNo)
Windows(wkb.Name).Visible = False
If vAns = vbYes Then .Save Else .Saved = True
End With 'wkb
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Ads
  #12  
Old June 27th 12, 06:32 PM posted to microsoft.public.excel.programming
Ggalla1779
external usenet poster
 
Posts: 11
Default Changing a csv file opened as hidden workbook


thanks

Its behaving better (although still not optimised)


1 thing I am stuck at..... when data file sheet is copied then i goto close workbook and it still asks me do I want to save spreadsheet...... why?

If Not xlWkb1 Is Nothing Then
xlWkb1.Close savechanges:=False
xlApp1.Quit
End If
  #13  
Old June 27th 12, 08:32 PM posted to microsoft.public.excel.programming
Gord Dibben[_2_]
external usenet poster
 
Posts: 572
Default Changing a csv file opened as hidden workbook

Tell Excel the file has been saved even though it has not been.

xlWkb1.Close Saved = True


Gord


On Wed, 27 Jun 2012 10:32:39 -0700 (PDT), Ggalla1779
> wrote:

>
>thanks
>
>Its behaving better (although still not optimised)
>
>
>1 thing I am stuck at..... when data file sheet is copied then i goto close workbook and it still asks me do I want to save spreadsheet...... why?
>
>If Not xlWkb1 Is Nothing Then
> xlWkb1.Close savechanges:=False
> xlApp1.Quit
> End If

  #14  
Old June 27th 12, 11:13 PM posted to microsoft.public.excel.programming
Ggalla1779
external usenet poster
 
Posts: 11
Default Changing a csv file opened as hidden workbook



thanks gord give that a go
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook has [Group] at the end of teh file name when opened belinda Excel Programming 1 November 21st 08 01:12 PM
Workbook has [Group] at the end of teh file name when opened MikeR-Oz New Users to Excel 2 September 12th 08 12:55 PM
Keeping a workbook hidden when opened via VBA??? Simon Lloyd[_585_] Excel Programming 3 October 6th 04 03:21 PM
Keeping a workbook hidden when opened via VBA??? Simon Lloyd[_586_] Excel Programming 0 October 6th 04 03:16 PM
Is Workbook read-only because of file permission or because file is already opened? balexis Excel Programming 0 September 29th 04 02:29 PM


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


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