Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Padding in cells added to imported spreadsheet

I've got on spreadsheet that has the values I need for another spreadsheet.
The portion of the code I have been using is:

Workbooks.OpenXML Filename:=strSelectedFile, LoadOption:= _
xlXmlLoadImportToList
Set wbXMLSource = ActiveWorkbook
Cells.Select
Selection.Copy
wbXMLSource.Close (False)
Set wbXMLSource = Nothing
Application.DisplayAlerts = False
wbMain.Activate
wsXMLSource.Activate
Cells.PasteSpecial

The problem is that when the PasteSpecial takes place, instead of the values
being in columns, everything ends up in column 1. A picture of the end result
is below:


bridge_keyPolicy.ModalPremium 25000
What you can't see in this message is that the before the word "bridge" in
the above there are 6 boxes that magically appeared as spacers. Further the
25000 has a box between it and the end of "bridge_keyPolicy.ModalPremium".

What is supposed to be happening is that the "bridge_keyPolicy.ModalPremium"
should be in column 7 and the 25000 should be in column 8. The first six
columns should be blank.

Instead everything ends up being packed together in Column 1. All of the
rows are there - but everything is in Column 1.

How can I parse this in a macro?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Padding in cells added to imported spreadsheet

Hi Don,

From the snippet of code you have provided I am completely confused by what
is the source data and what is the destination. However, I don't think you
can close the source that you are copying until after pasting to the
destination.

Try moving the following lines to after the Paste special.
wbXMLSource.Close (False)
Set wbXMLSource = Nothing

Also your paste special should have more parameters something like the
following.

Cells(1, 1).PasteSpecial Paste:=xlPasteValues

--
Regards,

OssieMac


"Don Kline" wrote:

I've got on spreadsheet that has the values I need for another spreadsheet.
The portion of the code I have been using is:

Workbooks.OpenXML Filename:=strSelectedFile, LoadOption:= _
xlXmlLoadImportToList
Set wbXMLSource = ActiveWorkbook
Cells.Select
Selection.Copy
wbXMLSource.Close (False)
Set wbXMLSource = Nothing
Application.DisplayAlerts = False
wbMain.Activate
wsXMLSource.Activate
Cells.PasteSpecial

The problem is that when the PasteSpecial takes place, instead of the values
being in columns, everything ends up in column 1. A picture of the end result
is below:


bridge_keyPolicy.ModalPremium 25000
What you can't see in this message is that the before the word "bridge" in
the above there are 6 boxes that magically appeared as spacers. Further the
25000 has a box between it and the end of "bridge_keyPolicy.ModalPremium".

What is supposed to be happening is that the "bridge_keyPolicy.ModalPremium"
should be in column 7 and the 25000 should be in column 8. The first six
columns should be blank.

Instead everything ends up being packed together in Column 1. All of the
rows are there - but everything is in Column 1.

How can I parse this in a macro?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Padding in cells added to imported spreadsheet

Moving the two lines as you suggested did solve the problem.

I'm good to go. Thanks for your help.

"OssieMac" wrote:

Hi Don,

From the snippet of code you have provided I am completely confused by what
is the source data and what is the destination. However, I don't think you
can close the source that you are copying until after pasting to the
destination.

Try moving the following lines to after the Paste special.
wbXMLSource.Close (False)
Set wbXMLSource = Nothing

Also your paste special should have more parameters something like the
following.

Cells(1, 1).PasteSpecial Paste:=xlPasteValues

--
Regards,

OssieMac


"Don Kline" wrote:

I've got on spreadsheet that has the values I need for another spreadsheet.
The portion of the code I have been using is:

Workbooks.OpenXML Filename:=strSelectedFile, LoadOption:= _
xlXmlLoadImportToList
Set wbXMLSource = ActiveWorkbook
Cells.Select
Selection.Copy
wbXMLSource.Close (False)
Set wbXMLSource = Nothing
Application.DisplayAlerts = False
wbMain.Activate
wsXMLSource.Activate
Cells.PasteSpecial

The problem is that when the PasteSpecial takes place, instead of the values
being in columns, everything ends up in column 1. A picture of the end result
is below:


bridge_keyPolicy.ModalPremium 25000
What you can't see in this message is that the before the word "bridge" in
the above there are 6 boxes that magically appeared as spacers. Further the
25000 has a box between it and the end of "bridge_keyPolicy.ModalPremium".

What is supposed to be happening is that the "bridge_keyPolicy.ModalPremium"
should be in column 7 and the 25000 should be in column 8. The first six
columns should be blank.

Instead everything ends up being packed together in Column 1. All of the
rows are there - but everything is in Column 1.

How can I parse this in a macro?

Reply
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
scroll automatically as data is imported into a spreadsheet Light Meter Reader Excel Discussion (Misc queries) 1 February 26th 09 11:36 PM
Data added to a spreadsheet will not automatically add, help! CBP Excel Discussion (Misc queries) 1 February 21st 06 06:47 PM
Can MS Works spreadsheet be imported into Excel? blair Excel Discussion (Misc queries) 1 September 26th 05 07:16 PM
Imported data... the incredible growing/shrinking spreadsheet Ben Adler Excel Programming 1 June 29th 05 09:01 PM
How do I append imported text down an Excel Spreadsheet? Jdicicco Excel Worksheet Functions 1 February 17th 05 01:02 PM


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