Click here to Skip to main content
15,902,635 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: open file location thru windows explorer Pin
Richard Andrew x644-Oct-15 13:27
professionalRichard Andrew x644-Oct-15 13:27 
GeneralRe: open file location thru windows explorer Pin
Mendel Margallo Adona5-Oct-15 18:10
Mendel Margallo Adona5-Oct-15 18:10 
GeneralRe: open file location thru windows explorer Pin
Mendel Margallo Adona6-Oct-15 0:34
Mendel Margallo Adona6-Oct-15 0:34 
AnswerRe: open file location thru windows explorer Pin
Mendel Margallo Adona6-Oct-15 4:02
Mendel Margallo Adona6-Oct-15 4:02 
QuestionVb6 resource file and ms access database Pin
Otekpo Emmanuel3-Oct-15 2:29
Otekpo Emmanuel3-Oct-15 2:29 
AnswerRe: Vb6 resource file and ms access database Pin
Dave Kreskowiak3-Oct-15 4:58
mveDave Kreskowiak3-Oct-15 4:58 
GeneralRe: Vb6 resource file and ms access database Pin
Otekpo Emmanuel5-Oct-15 6:35
Otekpo Emmanuel5-Oct-15 6:35 
QuestionExcel Macros - copy & paste from one workbook to another Pin
MikeK3229-Sep-15 6:17
MikeK3229-Sep-15 6:17 
I have two workbooks that I am working with. I am trying to copy a range of cells from one workbook to another. The source workbook will already be open and the destination workbook might not be open all the time. I am a little new at VBA. I have looked at some code from different sources on this topic. This is what I have so far.

I get the following Compiler Error: Invalid use of property
This happens when trying to open the destination workbook.

Sub export_data()

'
'

'Delcare variables
Dim xlApp As New Excel.Application
Dim xlworkbook1, xlworkbook2 As Excel.Workbooks
Dim xlworksheet1, xlworksheet2 As Excel.Worksheets
Dim xlSourceRange, xlDestRange As Excel.Range

'Set the source workbook
xlworkbook1 = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Greystone\GDI Line\Holey Paper Templates\Denso GDI Holey Paper Rev 5.xls")

'Open destination workbook
xlworkbook2 = xlApp.Workbooks.Open("C:\Users\Michael\Documents\Greystone\GDI Line\Denso GDI (Hitachi Templates 7.9.2015)\Hitachi 1.xlsm")

'Display Excel
xlApp.Visible = True

'Set the source active worksheet
If xlworksheet1 = Worksheets("GDI Connector").Activate Then
xlworksheet1 = xlworkbook1.Sheets("GDI Connector")
Else
xlworksheet1 = xlworkbook.Sheets("GDI Core")
End If

'Set the destination worksheet
xlworksheet2 = xlworkbook2.Sheets("Export")

'Set the source range
xlSourceRange = xlWorkSheet.Range("F1:F120")

'Set the destination range
xlDestRange = xlWorkSheet.Range("B34")

'Copy and past the range
xlSourceRange.Copy = (xlDestRange)

'
Application.Goto Reference:="export_data"
ActiveWorkbook.Save
End Sub

Any help would be much appreciated.
AnswerRe: Excel Macros - copy & paste from one workbook to another Pin
CHill6030-Sep-15 0:21
mveCHill6030-Sep-15 0:21 
GeneralRe: Excel Macros - copy & paste from one workbook to another Pin
MikeK3230-Sep-15 9:14
MikeK3230-Sep-15 9:14 
GeneralRe: Excel Macros - copy & paste from one workbook to another Pin
CHill6030-Sep-15 10:27
mveCHill6030-Sep-15 10:27 
QuestionPenny for Pay question Pin
BrianStrong28-Sep-15 14:10
BrianStrong28-Sep-15 14:10 
AnswerRe: Penny for Pay question Pin
Richard MacCutchan28-Sep-15 21:43
mveRichard MacCutchan28-Sep-15 21:43 
AnswerRe: Penny for Pay question Pin
Chris Quinn29-Sep-15 0:53
Chris Quinn29-Sep-15 0:53 
AnswerRe: Penny for Pay question Pin
Matt T Heffron29-Sep-15 10:35
professionalMatt T Heffron29-Sep-15 10:35 
QuestionPlease explain this. Pin
Member 1201796828-Sep-15 11:40
Member 1201796828-Sep-15 11:40 
AnswerRe: Please explain this. Pin
Dave Kreskowiak28-Sep-15 12:22
mveDave Kreskowiak28-Sep-15 12:22 
QuestionImport data from photon Pin
Member 1051522527-Sep-15 19:10
professionalMember 1051522527-Sep-15 19:10 
Questionconverting a embedded xml file resource to a xml object Pin
jkirkerx23-Sep-15 9:51
professionaljkirkerx23-Sep-15 9:51 
Answer[Cancel That] Pin
jkirkerx23-Sep-15 11:36
professionaljkirkerx23-Sep-15 11:36 
QuestionEmbedded Windows Media Player stream playing query Pin
Magrat23-Sep-15 8:26
Magrat23-Sep-15 8:26 
QuestionHOw I can find a sent mail with vba? Pin
Member 1199849020-Sep-15 13:21
Member 1199849020-Sep-15 13:21 
AnswerRe: HOw I can find a sent mail with vba? Pin
Dave Kreskowiak25-Sep-15 14:56
mveDave Kreskowiak25-Sep-15 14:56 
QuestionCan radio buttons have more than 1 function? Pin
Member 1199784020-Sep-15 3:55
Member 1199784020-Sep-15 3:55 
SuggestionRe: Can radio buttons have more than 1 function? Pin
Maciej Los20-Sep-15 5:32
mveMaciej Los20-Sep-15 5:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.